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);
}
}