private void UpdateTileWithText_Click(object sender, RoutedEventArgs e) { // Note: This sample contains an additional project, NotificationsExtensions. // NotificationsExtensions exposes an object model for creating notifications, but you can also // modify the strings directly. See UpdateTileWithTextWithStringManipulation_Click for an example // create the wide template ITileWideText03 tileContent = TileContentFactory.CreateTileWideText03(); tileContent.TextHeadingWrap.Text = "Hello World! My very own tile notification"; // Users can resize tiles to square or wide. // Apps can choose to include only square assets (meaning the app's tile can never be wide), or // include both wide and square assets (the user can resize the tile to square or wide). // Apps cannot include only wide assets. // Apps that support being wide should include square tile notifications since users // determine the size of the tile. // create the square template and attach it to the wide template ITileSquareText04 squareContent = TileContentFactory.CreateTileSquareText04(); squareContent.TextBodyWrap.Text = "Hello World! My very own tile notification"; tileContent.SquareContent = squareContent; // send the notification TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); OutputTextBlock.Text = MainPage.PrettyPrint(tileContent.GetContent()); }
void UpdateTile_Click(object sender, RoutedEventArgs e) { ITileWideText03 tileContent = TileContentFactory.CreateTileWideText03(); tileContent.TextHeadingWrap.Text = TextContent.Text; ITileSquareText04 squareTileContent = TileContentFactory.CreateTileSquareText04(); squareTileContent.TextBodyWrap.Text = TextContent.Text; tileContent.SquareContent = squareTileContent; TileNotification tileNotification = tileContent.CreateNotification(); string tag = "TestTag01"; if (!Id.Text.Equals(String.Empty)) { tag = Id.Text; } // set the tag on the notification tileNotification.Tag = tag; TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification); OutputTextBlock.Text = "Tile notification sent. It is tagged with " + tag; }
private void UpdateTileWithText() { ITileWideText03 tileContent = TileContentFactory.CreateTileWideText03(); tileContent.TextHeadingWrap.Text = "你有三条未读短信!"; ITileSquareText04 squareContent = TileContentFactory.CreateTileSquareText04(); squareContent.TextBodyWrap.Text = "你有三条未读短信!"; tileContent.SquareContent = squareContent; TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); }
void SendTileNotificationText_Click(object sender, RoutedEventArgs e) { ITileWideText03 tileContent = TileContentFactory.CreateTileWideText03(); // check out /en-US/resources.resw to understand where this string will come from tileContent.TextHeadingWrap.Text = "ms-resource:greeting"; ITileSquareText04 squareTileContent = TileContentFactory.CreateTileSquareText04(); squareTileContent.TextBodyWrap.Text = "ms-resource:greeting"; tileContent.SquareContent = squareTileContent; TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); OutputTextBlock.Text = MainPage.PrettyPrint(tileContent.GetContent()); }
private async void CreateBadgeAndTextTile_Click(object sender, RoutedEventArgs e) { if (!SecondaryTile.Exists(TEXT_TILE_ID)) { SecondaryTile secondTile = new SecondaryTile( TEXT_TILE_ID, "LockText", "LockScreen CS - Badge and tile text", "TEXT_ARGS", TileOptions.ShowNameOnLogo | TileOptions.ShowNameOnWideLogo, new Uri("ms-appx:///images/squareTile-sdk.png"), new Uri("ms-appx:///images/tile-sdk.png") ); secondTile.LockScreenBadgeLogo = new Uri("ms-appx:///images/badgelogo-sdk.png"); secondTile.LockScreenDisplayBadgeAndTileText = true; bool isPinned = await secondTile.RequestCreateForSelectionAsync(GetElementRect((FrameworkElement)sender), Placement.Above); if (isPinned) { ITileWideText03 tileContent = TileContentFactory.CreateTileWideText03(); tileContent.TextHeadingWrap.Text = "Text for the lock screen"; tileContent.RequireSquareContent = false; TileUpdateManager.CreateTileUpdaterForSecondaryTile(TEXT_TILE_ID).Update(tileContent.CreateNotification()); rootPage.NotifyUser("Secondary tile created and 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 and text secondary tile already exists.", NotifyType.ErrorMessage); } }