每分钟Windows Phone 8更新此自定义平铺

时间:2015-03-29 16:35:40

标签: c# xaml windows-phone-8

我有一个自定义图块,一个使用xaml的图像,不同尺寸的图像。

如何每分钟使用Windows Phone 8.1更新此自定义磁贴? (我目前正在运行Windows Phone 8,所以我假设我需要将其更新为8.1?)。

在瓷砖上显示公交车时间是可行的吗?

Code是我创建Tile的方法 - 如何将其整合到每分钟更新的Sample Clock Tile App中?

 TileControl2LiveM frontTile4 = new TileControl2LiveM();
                 TileName = "";
                 TileName = BusNameWNaptan;
                 TileData tileData4 = new TileData()

                 {
                     Text1 = BusNameWNaptan,
                     Service1 = Service1,
                     Service2 = Service2,
                     Service3 = Service3,

                     Destination1 = Destination1,
                     Destination2 = Destination2,
                     Destination3 = Destination3,

                     Time1 = Time1,
                     Time2 = Time2,
                     Time3 = Time3,

                     Updated = "Last Updated: " + shorttime

                     // myDateTime.ToShortTimeString());
                 };

                 frontTile4.DataContext = tileData4;
                 frontTile4.Measure(new Size(173, 173));
                 frontTile4.Arrange(new Rect(0, 0, 173, 173));
                 var bmp4 = new WriteableBitmap(173, 173);
                 bmp4.Render(frontTile4, null);
                 bmp4.Invalidate();

                 var isf4 = IsolatedStorageFile.GetUserStoreForApplication();
                 var filename4 = "/Shared/ShellContent/med" + BusNameWNaptan + ".jpg";


            {
                     using (var stream4 = isf.OpenFile(filename4, System.IO.FileMode.OpenOrCreate))
                     {
                         bmp4.SaveJpeg(stream4, 173, 173, 0, 100);
                     }


 var data4 = new FlipTileData
                     {
                         BackBackgroundImage = new Uri("isostore:/Shared/ShellContent/med/" + BusNameWNaptan + ".jpg", UriKind.Absolute)
                     };
                 }

FlipTileData TileData = new FlipTileData()
                {
                    //Title = "[title]",
                    //BackTitle = "[back of Tile title]",
                    //BackContent = "[back of medium Tile size content]",
                    //WideBackContent = "[back of wide Tile size content]",
                    //Count = [count],
                    SmallBackgroundImage = new Uri("isostore:/Shared/ShellContent/" + BusNameWNaptan + ".jpg", UriKind.Absolute),
                    BackgroundImage = new Uri("isostore:/Shared/ShellContent/" + BusNameWNaptan + ".jpg", UriKind.Absolute),
                    //BackBackgroundImage = new Uri(filename, UriKind.Relative),
                    WideBackgroundImage = new Uri("isostore:/Shared/ShellContent/wide" + BusNameWNaptan + ".jpg", UriKind.Absolute),
                    WideBackBackgroundImage = new Uri("isostore:/Shared/ShellContent/live" + BusNameWNaptan + ".jpg", UriKind.Absolute),
                };

0 个答案:

没有答案