Cookie Consent by Free Privacy Policy Generator
Privacy
Polipone
<settembre 2024>
lunmarmergiovensabdom
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456
Immagini  

UniversalApp - Notification

Aggiungere al progetto le classi della notification extension

 

Impostare il progetto come Toast Capable

notification1.png


Le notifiche Toast utilizzano un template XML, pertanto le classi di Notification Extension ci aiutano a nascondere la complessità dell'XML

 

                //INVIO UNA NOTIFICA PUSH

                IToastNotificationContent toastContent = null;

                IToastText02 templateContent = ToastContentFactory.CreateToastText02();

                templateContent.TextHeading.Text = "Stickers";

                templateContent.TextBodyWrap.Text = "You have " + numRichieste.ToString() + " requests";

                toastContent = templateContent;

 

                // Create a toast, then create a ToastNotifier object to show  the toast

                ToastNotification toast = toastContent.CreateNotification();

                ToastNotificationManager.CreateToastNotifier().Show(toast);

 

 

Aggiungere un BADGE ad una TILE

XmlDocument badgeXml = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber);

           XmlElement badgeElement = (XmlElement)badgeXml.SelectSingleNode("/badge");

           badgeElement.SetAttribute("value", numRichieste.ToString());

           BadgeNotification badge = new BadgeNotification(badgeXml);

           BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badge);

Notifiche