Lập trình Windows Phone - Module 3 – Bài 8: Live Tiles

Giới thiệu Live Tiles

Cách tạo Live Tiles

Iconic

Flip

Cyclic

Cách update Tiles

 

pptx21 trang | Chia sẻ: Mr Hưng | Lượt xem: 709 | Lượt tải: 0download
Bạn đang xem trước 20 trang nội dung tài liệu Lập trình Windows Phone - Module 3 – Bài 8: Live Tiles, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
Lập trình Windows Phone Module 3 – Bài 8: Live TilesGV Biên soạn: Trần Duy ThanhNội dungGiới thiệu Live TilesCách tạo Live TilesIconicFlipCyclicCách update Tiles1. Giới thiệu Live Tilesusing Microsoft.Phone.Shell;2. Cách tạo Live TilesTa có thể tạo Live Tiles bằng 2 cách:XAMLCoding behind2. Cách tạo Live TilesXAMLChỉnh trong WMAppManifest.xml (GUI và XAML)GUI:2. Cách tạo Live TilesXAMLAssets\Tiles\FlipCycleTileSmall.png0My Title2. Cách tạo Live TilesCoding behindvar tileData = new IconicTileData() { Title = "Surf Sites", SmallIconImage=, IconImage =, Count = 6 };2. Cách tạo Live TilesCoding behindUri uri = new Uri("/SecondPage.xaml", UriKind.Relative);var tile = ShellTile.ActiveTiles.FirstOrDefault(t => t.NavigationUri.Equals(uri));if (tile == null) {ShellTile.Create(uri, tileData, true);}else {tile.Update(tileData);};3. Iconic3. Iconic63. Iconic Uri uri = new Uri(); var tileData = new IconicTileData() { Title = "Surf Sites", SmallIconImage =, Count = 6, WideContent1 = "LargeContent1", }; ShellTile.Create(uri, tileData, true);4. Flip4. Flip 6 Surf Sites 4. FlipUri uri = new Uri("/SecondPage.xaml", UriKind.Relative); var tileData = new FlipTileData() { Title = "Surf Sites", SmallBackgroundImage = new Uri(), BackgroundImage =, Count = 6,};4. FlipShellTile oldTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri == uri); if (oldTile == null) { ShellTile.Create(uri, tileData, true); } else { oldTile.Update(tileData); }5. CyclicTemplate cho phép hiển thị 9 hình ảnh liên tiếp theo chu kỳ5. Cyclic Surf Sites 65. CyclicUri uri = new Uri(); var tileData = new CycleTileData() { Title = "Surf Sites", Count = 6, CycleImages = new List() { new Uri(), new Uri(), }, };5. CyclicShellTile oldTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri == uri); if (oldTile == null) { ShellTile.Create(uri, tileData, true); } else { oldTile.Update(tileData); }6. Cách update TilesTa dùng ShellTileSchedule trong namespace Microsoft.Phone.Shell để cập nhập Tiles.var tileSchedule = new ShellTileSchedule();tileSchedule.StartTime = DateTime.Now;tileSchedule.Recurrence = UpdateRecurrence.Interval;tileSchedule.Interval = UpdateInterval.EveryHour;Uri remoteUri = new Uri(@"");tileSchedule.RemoteImageUri = remoteUri;tileSchedule.Start();Thảo luận

Các file đính kèm theo tài liệu này:

  • pptxwp_module3_bai8_live_tiles_2836.pptx
Tài liệu liên quan