public async Task EnqueueSchemeTileAsync(Scheme scheme) { var wideImage = await bitmapService.CreateSchemeBitmapAsync(scheme, TileSize.Wide); var squareImage = await bitmapService.CreateSchemeBitmapAsync(scheme, TileSize.Square); var wideTile = TileContentFactory.CreateTileWide310x150ImageAndText01(); var squareTile = TileContentFactory.CreateTileSquare150x150PeekImageAndText01(); wideTile.Square150x150Content = squareTile; squareTile.Branding = TileBranding.None; squareTile.Image.Src = squareImage; squareTile.TextHeading.Text = scheme.Name; wideTile.Branding = TileBranding.None; wideTile.Image.Src = wideImage; wideTile.TextCaptionWrap.Text = scheme.Name; var notification = wideTile.CreateNotification(); notification.Tag = scheme.Id.GetHashCode().ToString(); var tileUpdater = TileUpdateManager.CreateTileUpdaterForApplication(); tileUpdater.Update(notification); EnsureDefaultTile(); }
private void OnWindowVisibilityChanged(object sender, VisibilityChangedEventArgs e) { if (!AppCallbacks.Instance.IsInitialized()) { return; } if (e.Visible) { AppCallbacks.Instance.InvokeOnAppThread(() => { GameManager.Instance.InitialiseSound(); }, false); AppCallbacks.Instance.UnityPause(0); return; } else { AppCallbacks.Instance.UnityPause(1); var smallContent = TileContentFactory.CreateTileSquare150x150PeekImageAndText01(); var wideContent = TileContentFactory.CreateTileWide310x150ImageAndText02(); var largeContent = TileContentFactory.CreateTileSquare310x310ImageAndText01(); AppCallbacks.Instance.InvokeOnAppThread(() => { var score = GameManager.Instance.GetScore(); AppCallbacks.Instance.InvokeOnUIThread(() => { smallContent.Branding = TileBranding.None; smallContent.TextHeading.Text = "Score : " + score.ToString(); smallContent.Image.Src = "ms-appx:///Assets/SquareTile.png"; wideContent.Branding = TileBranding.None; // Set this to TileBranding.Name if you wish to display your game name on the tile. wideContent.TextCaption1.Text = "Score : " + score.ToString(); wideContent.Image.Src = "ms-appx:///Assets/WideLogo.png"; wideContent.RequireSquare150x150Content = false; largeContent.Branding = TileBranding.None; largeContent.Image.Src = "ms-appx:///Assets/SquareTile.png"; largeContent.TextCaptionWrap.Text = "Score : " + score.ToString(); largeContent.RequireWide310x150Content = false; var updaterWide = TileUpdateManager.CreateTileUpdaterForApplication(); updaterWide.Update(wideContent.CreateNotification()); var updaterLarge = TileUpdateManager.CreateTileUpdaterForApplication(); updaterLarge.Update(largeContent.CreateNotification()); //updater.Update(smallContent.CreateNotification()); }, false); }, false); } }
public void setTile(Exercise ex) { string imagePath_Wide = "ms-appx:///assets/tiles_images/wide_tile/" + ex.Title + ".jpg"; string imagePath_Square = "ms-appx:///assets/tiles_images/square_tile/" + ex.Title + ".jpg";; string title = ex.Title; string reps = "Reps: " + ex.Reps; string sets = "Sets: " + ex.Sets; ITileSquare310x310Image tileContent = TileContentFactory.CreateTileSquare310x310Image(); tileContent.Image.Src = imagePath_Square; tileContent.Image.Alt = "image"; // Create a notification for the Wide310x150 tile using one of the available templates for the size. ITileWide310x150PeekImage02 wideTile = TileContentFactory.CreateTileWide310x150PeekImage02(); wideTile.TextHeading.Text = title; wideTile.TextBody2.Text = reps; wideTile.TextBody3.Text = sets; wideTile.Image.Src = imagePath_Wide; // Create a notification for the Square150x150 tile using one of the available templates for the size. ITileSquare150x150PeekImageAndText01 square150x150Content = TileContentFactory.CreateTileSquare150x150PeekImageAndText01(); square150x150Content.Image.Src = imagePath_Square; square150x150Content.TextBody1.Text = title; square150x150Content.TextBody2.Text = reps; square150x150Content.TextBody3.Text = sets; // Create a notification for the Square71x71 tile using one of the available templates for the size. //ITileSquare71x71Image square71x71Content = TileContentFactory.CreateTileSquare71x71Image(); //square71x71Content.Image.Src = imagePath; // Attach the Square71x71 template to the Square150x150 template. //square150x150Content.Square71x71Content = square71x71Content; // Attach the Square150x150 template to the Wide310x150 template. wideTile.Square150x150Content = square150x150Content; // Attach the Wide310x150 to the Square310x310 template. tileContent.Wide310x150Content = wideTile; // Send the notification to the application’s tile. TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); }
/// <summary> /// Sets the MainTile with new Information /// </summary> /// <param name="income">Income of these month</param> /// <param name="spending">Spending of these month</param> /// <param name="earnings">Earnings of these month </param> public void UpdateMainTile(string income, string spending, string earnings) { TileUpdateManager.CreateTileUpdaterForApplication().Clear(); if (ServiceLocator.Current.GetInstance <TileSettingsViewModel>().ShowInfoOnMainTile) { ITileSquare310x310SmallImagesAndTextList04 tileContent = TileContentFactory.CreateTileSquare310x310SmallImagesAndTextList04(); tileContent.Image1.Src = "ms-appx:///Assets/Logo.png"; tileContent.TextHeading1.Text = Translation.GetTranslation("CashflowTileLabel"); tileContent.TextWrap1.Text = income; tileContent.TextWrap2.Text = spending; tileContent.TextWrap3.Text = earnings; // Create a notification for the Wide310x150 tile using one of the available templates for the size. ITileWide310x150SmallImageAndText02 wide310x150Content = TileContentFactory.CreateTileWide310x150SmallImageAndText02(); wide310x150Content.Image.Src = "ms-appx:///Assets/Logo.png"; wide310x150Content.TextHeading.Text = Translation.GetTranslation("CashflowTileLabel"); wide310x150Content.TextBody1.Text = income; wide310x150Content.TextBody2.Text = spending; wide310x150Content.TextBody3.Text = earnings; // Create a notification for the Square150x150 tile using one of the available templates for the size. ITileSquare150x150PeekImageAndText01 square150x150Content = TileContentFactory.CreateTileSquare150x150PeekImageAndText01(); square150x150Content.Image.Src = "ms-appx:///Assets/Logo.png"; square150x150Content.TextHeading.Text = Translation.GetTranslation("CashflowTileLabel"); square150x150Content.TextBody1.Text = income; square150x150Content.TextBody2.Text = spending; square150x150Content.TextBody3.Text = earnings; // Attach the Square150x150 template to the Wide310x150 template. wide310x150Content.Square150x150Content = square150x150Content; // Attach the Wide310x150 template to the Square310x310 template. tileContent.Wide310x150Content = wide310x150Content; // Send the notification to the application? tile. TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); } }
private void zmienlivetitle(object sender, RoutedEventArgs e) { var template = TileContentFactory.CreateTileSquare150x150PeekImageAndText01(); template.TextBody1.Text = "Wow ale super"; template.TextBody2.Text = "na"; template.TextBody3.Text = "150x150"; template.Image.Src = "ms-appx:///Assets/aaa.scale-400.png"; var wideTemlate = TileContentFactory.CreateTileWide310x150PeekImageAndText01(); wideTemlate.TextBodyWrap.Text = "WoW WoW 310x150"; wideTemlate.Image.Src = "ms-appx:///Assets/aaa.scale-400.png"; wideTemlate.Square150x150Content = template; TileNotification wideNotification = wideTemlate.CreateNotification(); TileUpdater updater = TileUpdateManager.CreateTileUpdaterForApplication(); updater.Update(wideNotification); }
public MainPage() { this.InitializeComponent(); ApplicationView.PreferredLaunchViewSize = new Size(770, 550); ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize; //notification IToastImageAndText02 weather_notifications = ToastContentFactory.CreateToastImageAndText02(); weather_notifications.TextHeading.Text = "Aplikacja pogodowa załadowana poprawnie"; weather_notifications.TextBodyWrap.Text = "WeatherApp"; ScheduledToastNotification giveittime; giveittime = new ScheduledToastNotification(weather_notifications.GetXml(), DateTime.Now.AddSeconds(2)); giveittime.Id = "Any_ID"; ToastNotificationManager.CreateToastNotifier().AddToSchedule(giveittime); //live tiles var template = TileContentFactory.CreateTileSquare150x150PeekImageAndText01(); template.TextBody1.Text = "Aplikacja pogodowa"; template.Image.Src = "ms-appx:///Assets/pogoda.png"; var wideTemlate = TileContentFactory.CreateTileWide310x150PeekImageAndText01(); wideTemlate.TextBodyWrap.Text = "Aplikacja pogodowa - szerszy tile"; wideTemlate.Image.Src = "ms-appx:///Assets/pogoda.png"; wideTemlate.Square150x150Content = template; TileNotification wideNotification = wideTemlate.CreateNotification(); TileUpdater updater = TileUpdateManager.CreateTileUpdaterForApplication(); updater.Update(wideNotification); }
//public static CreateSecondaryTile(string tileId) //{ //} /// <summary> /// 更新默认磁贴内容(不通用) /// </summary> /// <param name="tileModel"></param> public static void UpdateTileNotifications(string ImageSrc, string TextHeading, string TextBody1, string TextBody2, string TextBody3) { ITileWide310x150ImageAndText01 tileWide310x150ImageAndText01 = TileContentFactory.CreateTileWide310x150ImageAndText01(); ITileSquare150x150PeekImageAndText01 tileSquare150x150PeekImageAndText01 = TileContentFactory.CreateTileSquare150x150PeekImageAndText01(); //磁铁内容赋值 tileSquare150x150PeekImageAndText01.Image.Src = ImageSrc; tileSquare150x150PeekImageAndText01.TextHeading.Text = TextHeading; tileSquare150x150PeekImageAndText01.TextBody1.Text = TextBody1; tileSquare150x150PeekImageAndText01.TextBody2.Text = TextBody2; tileSquare150x150PeekImageAndText01.TextBody3.Text = TextBody3; tileWide310x150ImageAndText01.Square150x150Content = tileSquare150x150PeekImageAndText01; tileWide310x150ImageAndText01.Image.Src = "ms-appx:///Assets/WideLogo.scale-100.png"; tileWide310x150ImageAndText01.TextCaptionWrap.Text = TextHeading + TextBody1 + TextBody2 + TextBody3; //更新至磁贴 TileUpdateManager.CreateTileUpdaterForApplication().Update(tileWide310x150ImageAndText01.CreateNotification()); }
void UpdateLiveTiles() { try { //*********************************************** //Adjust these parameters with appropriate values string mediumImagePath = "/Assets/Logo.png"; string wideImagePath = "/Assets/WideLogo.png"; string mediumText1 = "Level"; // **Don't forget to localise** string mediumText2 = "Score"; string mediumText3 = "Time"; string mediumText4 = "Coins"; string mediumData1 = "99"; // **This data should come from a game class** string mediumData2 = "1234"; string mediumData3 = DateTime.Now.ToString("HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture); string mediumData4 = "7"; string wideText1 = mediumText1; // **These can be made different if more detail is wanted for wide tile ** string wideText2 = mediumText2; string wideText3 = mediumText3; string wideText4 = mediumText4; string wideData1 = mediumData1; string wideData2 = mediumData2; string wideData3 = mediumData3; string wideData4 = mediumData4; // //*********************************************** // Using NotificationsExtensions library to build up tile content // Choose the tile templates to use for 150x150, 310x150 and 310x310 sizes // Check this link for the tile catalog for Windows Store and Windows Phone: // https://msdn.microsoft.com/en-us/library/windows/apps/hh761491.aspx var mediumTile = TileContentFactory.CreateTileSquare150x150PeekImageAndText01(); var wideTile = TileContentFactory.CreateTileWide310x150PeekImage02(); var largeTile = TileContentFactory.CreateTileSquare310x310SmallImageAndText01(); // Set the branding value for the tiles (weather or not to display the app name) mediumTile.Branding = TileBranding.None; wideTile.Branding = TileBranding.None; largeTile.Branding = TileBranding.Name; //Set the tile template images mediumTile.Image.Src = mediumImagePath; wideTile.Image.Src = wideImagePath; largeTile.Image.Src = mediumImagePath; //Set the tile template text values mediumTile.TextHeading.Text = string.Format("{0}: {1}", mediumText1, mediumData1); mediumTile.TextBody1.Text = string.Format("{0}: {1}", mediumText2, mediumData2); mediumTile.TextBody2.Text = string.Format("{0}: {1}", mediumText3, mediumData3); mediumTile.TextBody3.Text = string.Format("{0}: {1}", mediumText4, mediumData4); wideTile.TextHeading.Text = string.Format("{0}: {1}", wideText1, wideData1); wideTile.TextBody1.Text = string.Format("{0}: {1}", wideText2, wideData2); wideTile.TextBody2.Text = string.Format("{0}: {1}", wideText3, wideData3); wideTile.TextBody3.Text = string.Format("{0}: {1}", wideText4, wideData4); wideTile.TextBody4.Text = string.Empty; largeTile.TextHeading.Text = string.Format("{0}: {1}", wideText1, wideData1); largeTile.TextBodyWrap.Text = string.Format("{0}: {1} - {2}: {3}", wideText2, wideData2, wideText4, wideData4); largeTile.TextBody.Text = string.Format("{0}: {1}", wideText3, wideData3); //This merges the tile templates together to create the single xml for all of them wideTile.Square150x150Content = mediumTile; largeTile.Wide310x150Content = wideTile; //Create the tile updater and update the tiles var updater = TileUpdateManager.CreateTileUpdaterForApplication(); //This is dumb... Will fix with an updated library soon var xml = largeTile.GetXml(); var xDoc = new XmlDocument(); xDoc.LoadXml(xml.ToString()); TileNotification tileNotification = new TileNotification(xDoc); updater.Update(tileNotification); // Reading the actual Xml to understand what is happening here. Debug.WriteLine(xml.ToString()); } catch (Exception ex) { Debug.WriteLine(ex); if (ExceptionLogger.IsEnabled) { ExceptionLogger.Send(ex); } } }