void UpdateTile() { try { var imgs = ViewModel.RecommandSection.First(g => g.Key.Contains("更新")).Take(6).ToArray(); var tileContent = TileContentFactory.CreateTileSquare310x310ImageCollectionAndText01(); tileContent.AddImageQuery = true; tileContent.ImageMain.Src = imgs[0].CoverImageUri; tileContent.ImageMain.Alt = imgs[0].Title; tileContent.ImageSmall1.Src = imgs[1].CoverImageUri; tileContent.ImageSmall1.Alt = imgs[1].Title; tileContent.ImageSmall2.Src = imgs[2].CoverImageUri; tileContent.ImageSmall2.Alt = imgs[2].Title; tileContent.ImageSmall3.Src = imgs[3].CoverImageUri; tileContent.ImageSmall3.Alt = imgs[3].Title; tileContent.ImageSmall4.Src = imgs[4].CoverImageUri; tileContent.ImageSmall4.Alt = imgs[4].Title; tileContent.TextCaptionWrap.Text = imgs[0].Description; // Create a notification for the Wide310x150 tile using one of the available templates for the size. //var wide310x150Content = TileContentFactory.CreateTileWide310x150ImageAndText01(); //wide310x150Content.TextCaptionWrap.Text = "This tile notification uses web images"; //wide310x150Content.Image.Src = ImgUri; //wide310x150Content.Image.Alt = "Web image"; var wide310x150Content = TileContentFactory.CreateTileWide310x150PeekImageCollection05(); wide310x150Content.AddImageQuery = true; //wide310x150Content.Lang = "zh-Hans"; wide310x150Content.ImageMain.Src = imgs[0].CoverImageUri; wide310x150Content.ImageMain.Alt = imgs[0].Title; wide310x150Content.ImageSecondary.Src = imgs[0].CoverImageUri; wide310x150Content.ImageSecondary.Alt = imgs[0].Title; wide310x150Content.ImageSmallColumn1Row1.Src = imgs[1].CoverImageUri; wide310x150Content.ImageSmallColumn1Row1.Alt = imgs[1].Title; wide310x150Content.ImageSmallColumn1Row2.Src = imgs[2].CoverImageUri; wide310x150Content.ImageSmallColumn1Row2.Alt = imgs[2].Title; wide310x150Content.ImageSmallColumn2Row1.Src = imgs[3].CoverImageUri; wide310x150Content.ImageSmallColumn2Row1.Alt = imgs[3].Title; wide310x150Content.ImageSmallColumn2Row2.Src = imgs[4].CoverImageUri; wide310x150Content.ImageSmallColumn2Row2.Alt = imgs[4].Title; wide310x150Content.TextHeading.Text = imgs[0].Title; wide310x150Content.TextBodyWrap.Text = imgs[0].Description; // Create a notification for the Square150x150 tile using one of the available templates for the size. var square150x150Content = TileContentFactory.CreateTileSquare150x150PeekImageAndText02(); //square150x150Content.Lang = "zh-Hans"; square150x150Content.Image.Src = imgs[0].CoverImageUri; square150x150Content.Image.Alt = imgs[0].Title; square150x150Content.TextHeading.Text = imgs[0].Title; square150x150Content.TextBodyWrap.Text = imgs[0].Description; //var square150x150Content = TileContentFactory.CreateTileSquare150x150Image(); //square150x150Content.Image.Src = ImgUri; //square150x150Content.Image.Alt = "Web image"; var square71x71Content = TileContentFactory.CreateTileSquare71x71Image(); square71x71Content.Image.Src = imgs[0].CoverImageUri;; square71x71Content.Image.Alt = imgs[0].Title; // Attached the Square71x71 template to the Square150x150 template. square150x150Content.Square71x71Content = square71x71Content; // 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’s tile. TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); } catch (Exception exception) { Debug.WriteLine(exception.Message); } }
public static void UpdateDisplay(String _appName, String _reward, Boolean _sample, String _picPath, List <String> _picAlbum, List <String> _countries) { ResourceLoader _res = ResourceLoader.GetForCurrentView(); String _textDesc = _res.GetString("ReviewDefinition"); String _uridemo = "ms-appx:///Assets/"; String _uriStart = _sample ? "ms-appx:///appdata/" : "ms-appdata:///local/"; String _src1, _src2, _src3, _src4; if (_picPath != null) { _src1 = _uriStart + _picPath + "/" + _picAlbum[0]; if (_picAlbum.Count < 2) { _src2 = _uridemo + "reward_0_blueViolet.png"; } else { _src2 = _uriStart + _picPath + "/" + _picAlbum[1]; } if (_picAlbum.Count < 3) { _src3 = _uridemo + "reward_1_blueViolet.png"; } else { _src3 = _uriStart + _picPath + "/" + _picAlbum[2]; } if (_picAlbum.Count < 4) { _src4 = _uridemo + "reward_2_blueViolet.png"; } else { _src4 = _uriStart + _picPath + "/" + _picAlbum[3]; } if (_countries.Count > 0) { _textDesc += " to "; foreach (String _country in _countries) { _textDesc += _country + ", "; } _textDesc += "..."; } } else { _src1 = _uridemo + "reward_0.png"; _src2 = _uridemo + "reward_1.png"; _src3 = _uridemo + "reward_2.png"; _src4 = _uridemo + "reward_3.png"; _reward = _uridemo + "reward_cup_1.png"; } _src1 = "ms-appx:///appdata/1221335346/83915936.jpg"; _src2 = "ms-appx:///appdata/1221335346/2112996589.jpg"; _src3 = "ms-appx:///appdata/1221335346/1915394806.jpg"; _src4 = "ms-appx:///appdata/1221335346/684173310.jpg"; // Create a notification for the Square310x310 tile using one of the available templates for the size. ITileSquare310x310ImageCollectionAndText01 tileContent = TileContentFactory.CreateTileSquare310x310ImageCollectionAndText01(); tileContent.TextCaptionWrap.Text = _textDesc; tileContent.ImageMain.Src = _reward; tileContent.ImageSmall1.Src = _src1; tileContent.ImageSmall2.Src = _src2; tileContent.ImageSmall3.Src = _src3; tileContent.ImageSmall4.Src = _src4; // Create a notification for the Wide310x150 tile using one of the available templates for the size. ITileWide310x150PeekImageCollection05 wide310x150Content = TileContentFactory.CreateTileWide310x150PeekImageCollection05(); wide310x150Content.TextBodyWrap.Text = _textDesc; wide310x150Content.TextHeading.Text = _appName; wide310x150Content.ImageSmallColumn1Row1.Src = _src1; wide310x150Content.ImageSmallColumn2Row1.Src = _src2; wide310x150Content.ImageSmallColumn1Row2.Src = _src3; wide310x150Content.ImageSmallColumn2Row2.Src = _src4; wide310x150Content.ImageMain.Src = _reward; wide310x150Content.ImageSecondary.Src = _reward; // Create a notification for the Square150x150 tile using one of the available templates for the size. ITileSquare150x150PeekImageAndText04 square150x150Content = TileContentFactory.CreateTileSquare150x150PeekImageAndText04(); square150x150Content.TextBodyWrap.Text = _textDesc; square150x150Content.Image.Src = _reward; // 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’s tile. TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); }