protected void Execute(object parameter, bool immediate) { MediaItemsListModelItem mediaItem = parameter as MediaItemsListModelItem; bool forceCurrent = false; if (immediate && App.Engine.DownloadManager.StartedDownloadsCount >= DownloadManager.KMaxSimultaneousDownloads) { MessageBoxResult result = MessageBox.Show(FileLanguage.MAX_DOWNLOAD_REACHED_QUESTION, FileLanguage.ARE_YOU_SURE, MessageBoxButton.OKCancel); forceCurrent = result == MessageBoxResult.OK; } ToastPrompt toast = new ToastPrompt(); switch (App.Engine.EnqueueMediaItem(mediaItem, immediate, forceCurrent)) { case Engine.AddingToQueueResult.ItemAlreadyDownloaded: toast.Message = String.Format(FileLanguage.DownloadCommand_AlreadyDownloaded, mediaItem.Title == String.Empty ? FileLanguage.DownloadCommand_Item : mediaItem.Title); break; case Engine.AddingToQueueResult.ItemAddedToQueue: toast.Message = String.Format(FileLanguage.DownloadCommand_AddedToDownload, mediaItem.Title == String.Empty ? FileLanguage.DownloadCommand_Item : mediaItem.Title); break; case Engine.AddingToQueueResult.DownloadItemStarted: toast.Message = String.Format(FileLanguage.DownloadCommand_DownloadingStarted, mediaItem.Title == String.Empty ? FileLanguage.DownloadCommand_Item : mediaItem.Title); break; } toast.Show(); }
public void Execute(object parameter) { MediaItemsListModelItem mediaItem = parameter as MediaItemsListModelItem; App.Engine.StatisticsManager.LogShowLinks(mediaItem); ((App.Current.RootVisual as PhoneApplicationFrame).Content as PhoneApplicationPage).NavigationService.Navigate(new Uri("/LinksListPage.xaml?id=" + mediaItem.Id, UriKind.Relative)); }
public void Execute(object parameter) { MediaItemsListModelItem mediaItem = parameter as MediaItemsListModelItem; switch (mediaItem.ItemState) { case MediaItemState.Local: // TEMPORARY: log media item playback App.Engine.StatisticsManager.LogMediaPlayback(mediaItem); if (mediaItem.IsChanged) { mediaItem.IsChanged = false; Library.markItemWatched(mediaItem.Id); } NedEngine.Utils.NavigateTo("/MediaItemsViewerPage.xaml?id=" + mediaItem.Id); break; case MediaItemState.Downloading: ToastPrompt toast = new ToastPrompt(); toast.Message = String.Format("{0} is already queued for download", mediaItem.Title == String.Empty ? "Item" : mediaItem.Title); toast.Show(); break; case MediaItemState.Remote: AddItemToQueueCommand.GetCommand().Execute(mediaItem); break; default: System.Diagnostics.Debug.Assert(false, "Unknown media item state when media item requested - unable to make decision what to do"); break; } }
private void OnMenuItemClicked(object sender, RoutedEventArgs args) { var menuItem = (MenuItem)sender; MediaItemsListModelItem mediaItem = (MediaItemsListModelItem)menuItem.CommandParameter; var tag = menuItem.Tag.ToString(); switch (tag) { case DeleteTag: DeleteLibraryItemCommand.GetCommand().Execute(mediaItem); break; case AddToQueueTag: AddItemToQueueCommand.GetCommand().Execute(mediaItem); break; case DownloadNowTag: DownloadNowCommand.GetCommand().Execute(mediaItem); break; case ShowLinksTag: ShowLinksCommand.GetCommand().Execute(mediaItem); break; case ShowDescriptionTag: ShowDescriptionCommand.GetCommand().Execute(mediaItem); break; default: break; } }
public MediaItemsViewerPage() { InitializeComponent(); MediaItemModel = new MediaItemsListModelItem(); PrepareApplicationBar(); }
public bool FilterItemsByKeyword(object item) { if (item == null) { return(false); } MediaItemsListModelItem mediaItem = item as MediaItemsListModelItem; return(mediaItem.Keywords.Contains(CurrentKeyword)); }
public void Execute(object parameter) { if (!_msgBoxLock) { _msgBoxLock = true; MediaItemsListModelItem mediaItem = parameter as MediaItemsListModelItem; App.Engine.StatisticsManager.LogShowMediaDetails(mediaItem); MessageBox.Show(mediaItem.Description); _msgBoxLock = false; } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs args) { IDictionary <string, string> parameters = NavigationContext.QueryString; Debug.Assert(parameters.ContainsKey("id")); ContentId = parameters["id"]; App.Engine.LibraryModel.LoadLibraryStateIfNotLoaded(); MediaItemModel = App.Engine.LibraryModel.GetMediaItemForId(ContentId); ContentPanel.DataContext = MediaItemModel.ExternalLinks; base.OnNavigatedTo(args); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs args) { IDictionary <string, string> parameters = NavigationContext.QueryString; string id = parameters["id"]; App.Engine.LibraryModel.LoadLibraryStateIfNotLoaded(); MediaItemModel = App.Engine.LibraryModel.GetMediaItemForId(id); if (id == null || MediaItemModel == null) { MessageBox.Show(FileLanguage.MediaItemViewerPage_CanNotOpenItem); System.Diagnostics.Debug.Assert(false, "Navigated to MediaItemsViewerPage without or with non-existant item ID"); } else { TitlePanel.TitleText = MediaItemModel.Title; } base.OnNavigatedTo(args); }
public void UpdatedView(MediaItemsListModelItem mediaItem) { switch (mediaItem.ItemType) { case MediaItemType.Picture: PictureItemModel pictureModel = new PictureItemModel(); pictureModel.LoadImage(mediaItem.GetMediaFileIsolatedStoragePath()); Content = pictureModel; ContentTemplate = PictureTemplate; break; case MediaItemType.Text: ContentTemplate = TextTemplate; break; case MediaItemType.Audio: Content = new AudioVideoItemModel() { MediaSource = mediaItem.GetMediaFileIsolatedStoragePath() }; ContentTemplate = AudioTemplate; break; case MediaItemType.Video: Content = new AudioVideoItemModel() { MediaSource = mediaItem.GetMediaFileIsolatedStoragePath() }; ContentTemplate = VideoTemplate; break; case MediaItemType.Undefined: ContentTemplate = UnknownTemplate; break; default: break; } }