Win10 UWP 开发学习代码(不断更新)

2016-05-16 19:47:28来源:cnblogs.com作者:SpringLeee人点击

Toast通知 


private void Button_Click(object sender, RoutedEventArgs e)        {            var toast = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText01);            var textNodes = toast.GetElementsByTagName("text");            textNodes[0].InnerText = "呵呵呵";            var Message = new ToastNotification(toast);            ToastNotificationManager.CreateToastNotifier().Show(Message);                    }

磁贴操作


 添加磁贴 

 

private async void Button_Click(object sender, RoutedEventArgs e)        {            //磁贴的唯一标识            string TitleId = "My_Title";            //磁贴展示名称            string DiaplayName = "我的磁贴";            //点击磁贴传入的参数            string args = DateTime.Now.ToString();            //磁贴图片URI            Uri LogoUri = new Uri("ms-appx:///Assets/cc.jpg");            //磁贴尺寸            var size = TileSize.Square150x150;            var Obj = new SecondaryTile(TitleId,DiaplayName,args,LogoUri,size);            Obj.VisualElements.ShowNameOnSquare150x150Logo = true;                        if (await Obj.RequestCreateAsync())            {                await new MessageDialog("OK").ShowAsync();            }                    }  

删除,修改磁贴

 private async void Button_Click_1(object sender, RoutedEventArgs e)        {            //磁贴的唯一标识            string TitleId = "My_Title";            var Title = new SecondaryTile(TitleId);            Title.VisualElements.ShowNameOnSquare150x150Logo = false;            await Title.RequestDeleteAsync();        }

 磁贴通知

            var toast = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText01);            var textNodes = toast.GetElementsByTagName("text");            textNodes[0].InnerText = "呵呵呵";            textNodes[1].InnerText = "你是猴子请来的救兵吗?";            textNodes[2].InnerText = "呵呵呵";            var Message = new TileNotification(toast);            TileUpdateManager.CreateTileUpdaterForSecondaryTile("My_Title").Update(Message);
  

 

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台