Windows Phone开发之ToastPrompt测试Demo与Coding4Fun效果对比(有图有真相)

来源:互联网 发布:工业机器人编程语言 编辑:程序博客网 时间:2024/04/30 01:05
昨天研究了一下Coding4Fun的对话框,发现还是太复杂,不符合我的风格,简单、低调就好。于是顺便看了一下ToastPrompt,然后做了一个面向对象封装

首先代码段

        /// <summary>        /// 信息提示        /// </summary>        /// <param name="content">提示的信息内容</param>        /// <param name="title">提示的标题</param>        /// <param name="timeout">提示消息的显示过期时间。单位毫秒</param>        public void Coding4FunForMsg(string content, string title, int timeout)        {            SolidColorBrush White = new SolidColorBrush(Colors.White);            SolidColorBrush Red = new SolidColorBrush(Colors.Brown);            ToastPrompt toast = new ToastPrompt            {                Background = Red,                IsTimerEnabled = true,                IsAppBarVisible = true,                 MillisecondsUntilHidden = timeout,                Foreground = White,            };            toast.Title = title;            toast.Message = content;            toast.TextOrientation = System.Windows.Controls.Orientation.Horizontal;            toast.Show();        }

其次调用:

 new Classes.Util.Msg().Coding4FunForMsg("this is content", "Title", 3000);

最后截图:(对比昨天的对话框,简直帅多了)

这是昨天的效果图:点击打开昨天的博客文章链接



这是上面代码的实现效果图:



结论:差异巨大,效果明显。手机显示小,但是人性化的提示和操作还是会赢得用户体验的!

原创粉丝点击