Cookie Consent by Free Privacy Policy Generator
Privacy
Polipone
<novembre 2024>
lunmarmergiovensabdom
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678
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