public void Execute(string command, IDictionary commandArgs) { ZuneShell defaultInstance = ZuneShell.DefaultInstance; if (defaultInstance == null) { throw new InvalidOperationException("No Shell instance has been registered. Unable to perform navigation."); } defaultInstance.CurrentPage.CommandHandler?.Execute(command, commandArgs); }
public static Attachment CreateAttachment(object obj) { DataProviderObject dataProviderObject = obj as DataProviderObject; MediaType mediaType = MediaType.Undefined; Guid zuneMediaId = Guid.Empty; VideoCategory videoCategory = VideoCategory.Other; string title = null; string url = null; int num = -1; if (dataProviderObject != null) { object property1 = dataProviderObject.GetProperty("ZuneMediaId"); if (property1 != null) { zuneMediaId = (Guid)property1; } if (dataProviderObject.GetProperty("Type") is string property) { mediaType = ZuneShell.MapStringToMediaType(property); } object property3 = dataProviderObject.GetProperty("LibraryId"); if (property3 != null) { num = (int)property3; } object property4 = dataProviderObject.GetProperty("CategoryId"); if (property4 != null) { videoCategory = (VideoCategory)property4; } title = dataProviderObject.GetProperty("Title") as string; switch (mediaType) { case MediaType.PodcastEpisode: object property5 = dataProviderObject.GetProperty("SeriesId"); if (property5 != null) { num = (int)property5; } zuneMediaId = PodcastLibraryPage.GetZuneMediaId(num); mediaType = MediaType.Podcast; title = dataProviderObject.GetProperty("SeriesTitle") as string; url = dataProviderObject.GetProperty("SeriesFeedUrl") as string; break; case MediaType.Podcast: url = dataProviderObject.GetProperty("FeedUrl") as string; break; } } return(CreateAttachment(zuneMediaId, mediaType, num, title, url, videoCategory, MovieType.Other)); }
public void Invoke(Category category, IDictionary commandArgs) { ZuneShell defaultInstance = ZuneShell.DefaultInstance; if (defaultInstance == null) { throw new InvalidOperationException("No Shell instance has been registered. Unable to perform navigation."); } CategoryPage categoryPage = new CategoryPage(this); categoryPage.CurrentCategory = category; if (commandArgs != null) { categoryPage.NavigationArguments = commandArgs; } defaultInstance.NavigateToPage(categoryPage); }
public static bool CanCreateAttachment(object obj) { DataProviderObject dataProviderObject = null; MediaType mediaType = MediaType.Undefined; Guid guid = Guid.Empty; int num = -1; bool flag = false; switch (obj) { case DataProviderObject _: dataProviderObject = (DataProviderObject)obj; object property1 = dataProviderObject.GetProperty("ZuneMediaId"); if (property1 != null) { guid = (Guid)property1; } object property2 = dataProviderObject.GetProperty("LibraryId"); if (property2 != null) { num = (int)property2; } if (dataProviderObject.GetProperty("Type") is string property3) { mediaType = ZuneShell.MapStringToMediaType(property3); break; } break; case PlaybackTrack _: PlaybackTrack playbackTrack = (PlaybackTrack)obj; guid = playbackTrack.ZuneMediaId; mediaType = playbackTrack.MediaType; break; } switch (mediaType) { case MediaType.Track: case MediaType.Album: flag = guid != Guid.Empty; break; case MediaType.Video: if (dataProviderObject != null && guid != Guid.Empty) { object property3 = dataProviderObject.GetProperty("CategoryId"); if (property3 != null) { VideoCategory videoCategory = (VideoCategory)property3; flag = videoCategory == VideoCategory.TV || videoCategory == VideoCategory.Movies; break; } break; } break; case MediaType.Playlist: if (dataProviderObject != null && (guid != Guid.Empty || num != -1)) { object property3 = dataProviderObject.GetProperty("PlaylistType"); if (property3 != null) { PlaylistType playlistType = (PlaylistType)property3; flag = playlistType != PlaylistType.Channel && playlistType != PlaylistType.PersonalChannel; break; } break; } break; case MediaType.PodcastEpisode: if (dataProviderObject != null) { object property3 = dataProviderObject.GetProperty("SeriesId"); if (property3 != null) { flag = PodcastLibraryPage.GetZuneMediaId((int)property3) != Guid.Empty || !string.IsNullOrEmpty(dataProviderObject.GetProperty("SeriesFeedUrl") as string); break; } break; } break; case MediaType.Podcast: flag = guid != Guid.Empty; if (!flag && dataProviderObject != null) { flag = !string.IsNullOrEmpty(dataProviderObject.GetProperty("FeedUrl") as string); break; } break; } return(flag); }