• Windows Phone开发之Coding4Fun对话框操作类


    去年把windows phone手机的自带弹出框和Coding4Fun做了一个对比【http://blog.csdn.net/fengyarongaa/article/details/7077031】。今天就把操作类全部贴出来。

    1.自己先下载一个Coding4Fun的dll文件,然后引用到项目里面,你懂的!

        下载地址http://coding4fun.codeplex.com/

    2.直接上代码。

    1. using System;  
    2. using System.Net;  
    3. using System.Windows;  
    4. using System.Windows.Controls;  
    5. using System.Windows.Documents;  
    6. using System.Windows.Ink;  
    7. using System.Windows.Input;  
    8. using System.Windows.Media;  
    9. using System.Windows.Media.Animation;  
    10. using System.Windows.Shapes;  
    11. using Coding4Fun.Phone;  
    12. using Coding4Fun.Phone.Controls;  
    13.   
    14. //@yr.feng  
    15. namespace MicroBlogForWP7.Classes.Util  
    16. {  
    17.     /// <summary>  
    18.     /// 对话框  
    19.     /// </summary>  
    20.     public class Msg  
    21.     {  
    22.         /// <summary>  
    23.         /// 带有"确定"和"取消"按钮消息提示框。返回值为bool类型  
    24.         /// </summary>  
    25.         /// <param name="content">提示的信息内容</param>  
    26.         /// <param name="title">提示的标题</param>  
    27.         /// <returns>ture or false</returns>  
    28.         public bool ReturnConfirfMsg(string content, string title)  
    29.         {  
    30.             MessageBoxResult m = MessageBox.Show(content, title, MessageBoxButton.OKCancel);  
    31.   
    32.             if (m == MessageBoxResult.OK)  
    33.             {  
    34.                 return true;  
    35.             }  
    36.             else  
    37.             {  
    38.                 return false;  
    39.             }  
    40.         }  
    41.   
    42.         /// <summary>  
    43.         /// 带有"确定"按钮消息提示框。返回值为bool类型  
    44.         /// </summary>  
    45.         /// <param name="content">提示的信息内容</param>  
    46.         /// <param name="title">提示的标题</param>  
    47.         /// <returns>ture or false</returns>  
    48.         public bool ReturnConfirfMsgByOk(string content, string title)  
    49.         {  
    50.             MessageBoxResult m = MessageBox.Show(content, title, MessageBoxButton.OK);  
    51.   
    52.             if (m == MessageBoxResult.OK)  
    53.             {  
    54.                 return true;  
    55.             }  
    56.             else  
    57.             {  
    58.                 return false;  
    59.             }  
    60.         }  
    61.   
    62.         /// <summary>  
    63.         /// 带"确定"按钮的消息提示框。不具有返回值  
    64.         /// </summary>  
    65.         /// <param name="content">提示的信息内容</param>  
    66.         /// <param name="title">提示的标题</param>  
    67.         public void ConfirfMsgForOK(string content, string title)  
    68.         {  
    69.             MessageBox.Show(content, title, MessageBoxButton.OK);  
    70.         }  
    71.   
    72.         /// <summary>  
    73.         /// 带"确定"和"取消"按钮的消息提示框。不具有返回值  
    74.         /// </summary>  
    75.         /// <param name="content">提示的信息内容</param>  
    76.         /// <param name="title">提示的标题</param>  
    77.         public void ConfirfMsgForOKCancel(string content, string title)  
    78.         {  
    79.             MessageBox.Show(content, title, MessageBoxButton.OKCancel);  
    80.         }  
    81.   
    82.         /// <summary>  
    83.         /// 使用Coding4Fun组件的淡入淡出对话框。不具有返回值  
    84.         /// </summary>  
    85.         /// <param name="content">提示的信息内容</param>  
    86.         /// <param name="title">提示的标题</param>  
    87.         /// <param name="timeout">提示消息的显示过期时间。单位毫秒</param>  
    88.         public void Coding4FunForMsg(string content, string title, int timeout)  
    89.         {  
    90.             SolidColorBrush White = new SolidColorBrush(Colors.White);  
    91.   
    92.             SolidColorBrush Red = new SolidColorBrush(Colors.Brown);  
    93.   
    94.             ToastPrompt toast = new ToastPrompt  
    95.             {  
    96.                 Background = Red,  
    97.                 IsTimerEnabled = true,  
    98.                 IsAppBarVisible = true,   
    99.                 MillisecondsUntilHidden = timeout,  
    100.                 Foreground = White,  
    101.             };  
    102.   
    103.             toast.Title = title;  
    104.   
    105.             toast.Message = content;  
    106.   
    107.             toast.TextOrientation = System.Windows.Controls.Orientation.Horizontal;  
    108.   
    109.             toast.Show();  
    110.         }  
    111.     }  
    112. }  
  • 相关阅读:
    video兼容ie,ckplayer网页播放器
    边框在2个边,不重叠不接触的情况下是梯形。
    【Unity】关于屏幕自适应的思路
    【Unity】鼠标指向某物体,在其上显示物体的名字等等等等信息
    【C#】关于左移/右移运算符的使用
    【Unity】鼠标点选物体
    Python time和datetime模块
    Python 模块之间的调用
    SaltStack 使用pillar安装配置管理zabbix
    SaltStack 实践课程一
  • 原文地址:https://www.cnblogs.com/songtzu/p/2611423.html
Copyright © 2020-2023  润新知