private void DeferredFileAddedStatus(object obj)
        {
            if (this.IsDisposed)
            {
                return;
            }
            int addCount;

            lock (this._lock)
            {
                this._deferredUpdatePending = false;
                addCount = this._addCount;
            }
            this._timerOnEndUpdates.Stop();
            this._timerOnEndUpdates.Start();
            if (Download.Instance.Notification != null)
            {
                return;
            }
            if (this._libraryNotification == null)
            {
                this._libraryNotification = new MessageNotification(_libraryActiveImportMessage, NotificationTask.Library, NotificationState.Normal);
                NotificationArea.Instance.RemoveAll(NotificationTask.Library, NotificationState.Completed);
                NotificationArea.Instance.Add(_libraryNotification);
                this.FirePropertyChanged("Importing");
            }
            this._libraryNotification.SubMessage = string.Format(_libraryAddFileMessage, addCount);
        }
 private void OnEndMetadataLifecycle() => Application.DeferredInvoke(delegate
 {
     if (this.IsDisposed)
     {
         return;
     }
     if (this._updateMetadataNotification != null && this._updateMetadataNotification.Type != NotificationState.Completed)
     {
         NotificationArea.Instance.Replace(_updateMetadataNotification, new MessageNotification("Metadata update completed", NotificationTask.Library, NotificationState.Completed));
         this._updateMetadataNotification = null;
     }
     this._updatingMetadata = false;
 }, null);
        private void OnEndUpdatesTick(object sender, EventArgs args)
        {
            int addCount;

            lock (this._lock)
            {
                addCount       = this._addCount;
                this._addCount = 0;
            }
            NotificationArea.Instance.Replace(_libraryNotification, new MessageNotification(_libraryFileChangeCompleteMessage, string.Format(_libraryAddFileMessage, addCount), NotificationTask.Library, NotificationState.Completed));
            this._libraryNotification = null;
            this.FirePropertyChanged("Importing");
        }
        private void OnFileDeleteFailed(IntPtr fileUrlPtr)
        {
            string strFileUrl = Marshal.PtrToStringUni(fileUrlPtr);

            Application.DeferredInvoke(delegate
            {
                if (this.IsDisposed || !this._updatingMetadata)
                {
                    return;
                }
                if (this._updateMetadataNotification == null)
                {
                    this._updateMetadataNotification = new MessageNotification(_metadataUpdateMessage, NotificationTask.Library, NotificationState.Normal);
                    NotificationArea.Instance.RemoveAll(NotificationTask.Library, NotificationState.Completed);
                    NotificationArea.Instance.Add(_updateMetadataNotification);
                }
                this._updateMetadataNotification.SubMessage = string.Format(_libraryFileDeleteFailedMessage, strFileUrl);
            }, null);
        }
        private void OnMetadataUpdate(IntPtr artistPtr, IntPtr albumPtr)
        {
            string artist = Marshal.PtrToStringUni(artistPtr);
            string album  = Marshal.PtrToStringUni(albumPtr);

            Application.DeferredInvoke(delegate
            {
                if (this.IsDisposed || !this._updatingMetadata)
                {
                    return;
                }
                if (this._updateMetadataNotification == null)
                {
                    this._updateMetadataNotification = new MessageNotification(_metadataUpdateMessage, NotificationTask.Library, NotificationState.Normal);
                    NotificationArea.Instance.RemoveAll(NotificationTask.Library, NotificationState.Completed);
                    NotificationArea.Instance.Add(_updateMetadataNotification);
                }
                this._updateMetadataNotification.SubMessage = string.Format(_metadataUpdateInfoMessage, artist, album);
            }, null);
        }
Example #6
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());
        }