private void PinTile() { if (IsPinned) { // Unpin the tile var tile = TileService.Current.GetTile(Constants.Pages.Remote.RemoteView); tile.Delete(); IsPinned = false; } else { var tileData = new ShellTileServiceFlipTileData { Title = "MB Remote", BackgroundImage = new Uri("/Assets/Tiles/MBRemoteTile.png", UriKind.Relative) }; var tileUrl = string.Format(Constants.PhoneTileUrlFormat, "Remote", string.Empty, "Remote Control"); TileService.Current.Create(new Uri(tileUrl, UriKind.Relative), tileData, false); IsPinned = true; } }
private void WireCommands() { PageLoaded = new RelayCommand(async () => { await GetEverything(false); if (!_hasLoaded) { ReviewReminderService.Current.Notify(); } }); RefreshDataCommand = new RelayCommand(async () => { await GetEverything(true); }); ChangeProfileCommand = new RelayCommand(() => { Log.Info("Signing out"); Reset(); _navService.NavigateTo(Constants.Pages.ChooseProfileView); }); PinCollectionCommand = new RelayCommand<BaseItemDto>(collection => { var tileUrl = string.Format(Constants.PhoneTileUrlFormat, "Collection", collection.Id, collection.Name); var existingTile = TileService.Current.GetTile(tileUrl); if (existingTile != default(ShellTileServiceTile)) { var result = MessageBox.Show(AppResources.MessageBoxUnpinText, AppResources.MessageBoxHeaderAreYouSure, MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { existingTile.Delete(); Messenger.Default.Send(new NotificationMessage(tileUrl, Constants.Messages.CollectionPinnedMsg)); } return; } #if WP8 //var tileDate = new ShellTileServiceCycleTileData //{ // Title = collection.Name, // CycleImages = new Collection<Uri> // { // new Uri("/Assets/Tiles/FlipCycleTileLarge.png", UriKind.Relative), // new Uri("/Assets/Tiles/FlipCycleTileMedium.png", UriKind.Relative) // }, // SmallBackgroundImage = new Uri("/Assets/Tiles/FlipCycleTileSmall.png", UriKind.Relative) //}; var tileData = new ShellTileServiceFlipTileData { Title = collection.Name, BackgroundImage = new Uri("/Assets/Tiles/FlipCycleTileMedium.png", UriKind.Relative), SmallBackgroundImage = new Uri("/Assets/Tiles/FlipCycleTileSmall.png", UriKind.Relative), WideBackgroundImage = new Uri("/Assets/Tiles/FlipCycleTileLarge.png", UriKind.Relative) }; TileService.Current.Create(new Uri(tileUrl, UriKind.Relative), tileData, true); #else var tileData = new ShellTileServiceStandardTileData { Title = collection.Name, BackBackgroundImage = new Uri("/Images/Logo.png", UriKind.Relative) }; TileService.Current.Create(new Uri(tileUrl, UriKind.Relative), tileData, false); #endif Messenger.Default.Send(new NotificationMessage(tileUrl, Constants.Messages.CollectionPinnedMsg)); }); PlayMovieCommand = new RelayCommand<BaseItemDto>(async item => { #if WP8 await PlayVideo(item); #endif }); ResumeMovieCommand = new RelayCommand<BaseItemDto>(async item => { await PlayVideo(item, true); }); NavigateToPage = new RelayCommand<BaseItemDto>(_navService.NavigateTo); NavigateToAPage = new RelayCommand<string>(_navService.NavigateTo); NavigateToNotificationsCommand = new RelayCommand(() => { Messenger.Default.Send(new NotificationMessage(Constants.Messages.NotifcationNavigationMsg)); _navService.NavigateTo(Constants.Pages.NotificationsView); }); }