예제 #1
0
        private void DeferredOnForegroundSubscriptionChanged(object args)
        {
            SubscriptonEventArguments subscriptonEventArguments = (SubscriptonEventArguments)args;

            if (subscriptonEventArguments.Action != SubscriptionAction.Unsubscribed && subscriptonEventArguments.UserInitiated && (subscriptonEventArguments.MediaType == EMediaTypes.eMediaTypePodcastSeries || subscriptonEventArguments.MediaType == EMediaTypes.eMediaTypePlaylist))
            {
                if (_notification == null)
                {
                    _notification = new MessageNotification(NotificationTask.Podcast, NotificationState.Normal);
                    NotificationArea.Instance.RemoveAll(NotificationTask.Podcast, NotificationState.Completed);
                    NotificationArea.Instance.Add(_notification);
                }
                _notification.SubMessage = subscriptonEventArguments.SubscriptionTitle;
                switch (subscriptonEventArguments.Action)
                {
                case SubscriptionAction.Subscribed:
                    if (EMediaTypes.eMediaTypePodcastSeries == subscriptonEventArguments.MediaType)
                    {
                        _notification.Message = Shell.LoadString(StringId.IDS_PODCAST_SUBSCRIBED_NOTIFICATION);
                    }
                    else if (EMediaTypes.eMediaTypePlaylist == subscriptonEventArguments.MediaType)
                    {
                        _notification.Message = Shell.LoadString(StringId.IDS_CHANNEL_SUBSCRIBED_NOTIFICATION);
                    }
                    _notification.Type = NotificationState.OneShot;
                    _notification      = null;
                    break;

                case SubscriptionAction.RefreshStarted:
                    if (EMediaTypes.eMediaTypePodcastSeries == subscriptonEventArguments.MediaType)
                    {
                        _notification.Message = Shell.LoadString(StringId.IDS_PODCAST_REFRESH_START_NOTIFICATION);
                    }
                    else if (EMediaTypes.eMediaTypePlaylist == subscriptonEventArguments.MediaType)
                    {
                        _notification.Message = Shell.LoadString(StringId.IDS_CHANNEL_REFRESH_START_NOTIFICATION);
                    }
                    _notification.Type = NotificationState.Normal;
                    break;

                case SubscriptionAction.RefreshFinished:
                    if (EMediaTypes.eMediaTypePodcastSeries == subscriptonEventArguments.MediaType)
                    {
                        _notification.Message = Shell.LoadString(StringId.IDS_PODCAST_REFRESH_END_NOTIFICATION);
                    }
                    else if (EMediaTypes.eMediaTypePlaylist == subscriptonEventArguments.MediaType)
                    {
                        _notification.Message = Shell.LoadString(StringId.IDS_CHANNEL_REFRESH_END_NOTIFICATION);
                    }
                    _notification.Type = NotificationState.Completed;
                    _notification      = null;
                    break;

                default:
                    return;
                }
            }
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs("SubscriptionChanged"));
            }
            if (this.SubscriptionChanged == null)
            {
                return;
            }
            this.SubscriptionChanged(this, new EventArgs());
        }
예제 #2
0
 private void OnForegroundSubscriptionChanged(SubscriptonEventArguments args) => Application.DeferredInvoke(new DeferredInvokeHandler(this.DeferredOnForegroundSubscriptionChanged), args, DeferredInvokePriority.Normal);