Cookie Consent by Free Privacy Policy Generator
Privacy
Polipone
<gennaio 2025>
lunmarmergiovensabdom
303112345
6789101112
13141516171819
20212223242526
272829303112
3456789
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