NotificationsExtensions.BadgeContent.BadgeNumericNotificationContent.CreateNotification C# (CSharp) Method

CreateNotification() public method

Creates a WinRT BadgeNotification object based on the content.
public CreateNotification ( ) : BadgeNotification
return BadgeNotification
        public BadgeNotification CreateNotification()
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(GetContent());
            return new BadgeNotification(xmlDoc);
        }

Usage Example

コード例 #1
0
        private async void CreateBadgeTile_Click(object sender, RoutedEventArgs e)
        {
            if (!SecondaryTile.Exists(BADGE_TILE_ID)) {
                SecondaryTile secondTile = new SecondaryTile(
                    BADGE_TILE_ID,
                    "LockScreen CS - Badge only",
                    "BADGE_ARGS",
                    new Uri("ms-appx:///images/squareTile-sdk.png"),
                    TileSize.Square150x150
                );
                secondTile.LockScreenBadgeLogo = new Uri("ms-appx:///images/badgelogo-sdk.png");

                bool isPinned = await secondTile.RequestCreateForSelectionAsync(GetElementRect((FrameworkElement) sender), Placement.Above);
                if (isPinned)
                {
                    BadgeNumericNotificationContent badgeContent = new BadgeNumericNotificationContent(2);
                    BadgeUpdateManager.CreateBadgeUpdaterForSecondaryTile(BADGE_TILE_ID).Update(badgeContent.CreateNotification());
                    rootPage.NotifyUser("Secondary tile created and badge updated. Go to PC settings to add it to the lock screen.", NotifyType.StatusMessage);
                }
                else 
                {
                    rootPage.NotifyUser("Tile not created.", NotifyType.ErrorMessage);
                }
                
            } else {
                rootPage.NotifyUser("Badge secondary tile already exists.", NotifyType.ErrorMessage);
            }
        }
All Usage Examples Of NotificationsExtensions.BadgeContent.BadgeNumericNotificationContent::CreateNotification