Пример #1
0
        private void OnThumbButtonPressed(uint uniqueID) => Application.DeferredInvoke(delegate
        {
            TransportControls instance = SingletonModelItem <TransportControls> .Instance;
            switch (uniqueID)
            {
            case 0:
                if (instance.Playing)
                {
                    instance.Pause.Invoke();
                    break;
                }
                instance.Play.Invoke();
                break;

            case 1:
                instance.Back.Invoke();
                break;

            case 2:
                instance.Forward.Invoke();
                break;

            case 3:
                if (this.IsCurrentTrackRatable())
                {
                    PlaybackTrack currentTrack = instance.CurrentTrack;
                    currentTrack.UserRating    = currentTrack.UserRating != 0 ? (currentTrack.UserRating > 5 ? 2 : 0) : 8;
                }
                this.UpdateButtonStatus();
                break;
            }
        }, null);
Пример #2
0
        public static void NavigateToLand()
        {
            PlaybackTrack currentTrack          = SingletonModelItem <TransportControls> .Instance.CurrentTrack;
            bool          exitOnPlaybackStopped = false;

            if (currentTrack != null && currentTrack.IsVideo)
            {
                exitOnPlaybackStopped = true;
            }
            NavigateToLand(false, exitOnPlaybackStopped);
        }
Пример #3
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);
        }
Пример #4
0
        private bool IsCurrentTrackRatable()
        {
            PlaybackTrack currentTrack = SingletonModelItem <TransportControls> .Instance.CurrentTrack;

            return(currentTrack != null && currentTrack.CanRate);
        }