protected override void OnInvoked()
        {
            switch (this.GetDownloadState())
            {
            case EDownloadTaskState.DLTaskPendingAttach:
            case EDownloadTaskState.DLTaskPending:
            case EDownloadTaskState.DLTaskDownloading:
            case EDownloadTaskState.DLTaskPaused:
                ZuneShell.DefaultInstance.Execute("Marketplace\\Downloads\\Home", null);
                break;

            case EDownloadTaskState.DLTaskComplete:
                PodcastLibraryPage.FindInCollection((int)this.m_episode.GetProperty("SeriesId"), (int)this.m_episode.GetProperty("LibraryId"));
                break;

            default:
                if (this.m_requireSignIn && !SignIn.Instance.SignedIn || this.m_explicit && ZuneApplication.Service.BlockExplicitContent())
                {
                    break;
                }
                DownloadEpisode(this.m_episode);
                this.Refresh();
                break;
            }
        }
Example #2
0
        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 FindInCollection()
        {
            Microsoft.Zune.Service.EContentType contentType = this.ContentType;
            if (contentType == Microsoft.Zune.Service.EContentType.PodcastEpisode)
            {
                PodcastLibraryPage.FindInCollection(-1, this.PodcastEpisodeId);
            }
            else if ((this.DownloadFlags & Microsoft.Zune.Service.EDownloadFlags.Channel) != Microsoft.Zune.Service.EDownloadFlags.None)
            {
                if (this.PlaylistId > 0)
                {
                    MusicLibraryPage.FindPlaylistInCollection(this.PlaylistId, this.CollectionId, true);
                }
                else
                {
                    ChannelLibraryPage.FindInCollection(this.SubscriptionMediaId, this.SubscriptionItemMediaId);
                }
            }
            else
            {
                if (this.CollectionId < 0)
                {
                    return;
                }
                switch (contentType)
                {
                case Microsoft.Zune.Service.EContentType.MusicTrack:
                    MusicLibraryPage.FindInCollection(-1, -1, this.CollectionId);
                    break;

                case Microsoft.Zune.Service.EContentType.Video:
                    VideoLibraryPage.FindInCollection(this.CollectionId);
                    break;

                case Microsoft.Zune.Service.EContentType.App:
                    ApplicationLibraryPage.FindInCollection(this.CollectionId);
                    break;
                }
            }
        }
        private void OnConfirm(object sender, EventArgs args)
        {
            SubscriptionManager instance = SubscriptionManager.Instance;
            int subscriptionMediaId      = -1;

            if (!instance.FindByUrl(this.m_feedUrl, EMediaTypes.eMediaTypePodcastSeries, out subscriptionMediaId, out bool _))
            {
                HRESULT hresult = instance.Subscribe(this.m_feedUrl, this.m_feedTitle, Guid.Empty, false, EMediaTypes.eMediaTypePodcastSeries, ESubscriptionSource.eSubscriptionSourceProtocolHandler, out subscriptionMediaId);
                if (hresult.IsSuccess)
                {
                    string endPointUri = Service.GetEndPointUri(EServiceEndpointId.SEID_RootCatalog);
                    if (!string.IsNullOrEmpty(endPointUri) && !string.IsNullOrEmpty(this.m_feedUrl) && this.m_feedUrl.Length < 1024)
                    {
                        WebRequestHelper.ConstructWebPostRequest(endPointUri + "/podcast", "URL=" + this.m_feedUrl, EPassportPolicyId.None, HttpRequestCachePolicy.Default, true, false).GetResponseAsync(new AsyncRequestComplete(this.OnRequestComplete), null);
                    }
                }
                else
                {
                    ErrorDialogInfo.Show(hresult.Int, Shell.LoadString(StringId.IDS_PODCAST_SUBSCRIPTION_ERROR));
                }
            }
            PodcastLibraryPage.FindInCollection(subscriptionMediaId);
        }
Example #5
0
        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);
        }