Example #1
0
        private async Task IndexingService_IndexingStatusChangedAsync(IndexingStatusEventArgs indexingStatusEventArgs)
        {
            await Task.Run(() =>
            {
                this.IsIndexing = this.indexingService.IsIndexing;

                if (this.IsIndexing)
                {
                    this.updateService.DisableUpdateCheck();
                    this.IsUpdateAvailable = false;

                    switch (indexingStatusEventArgs.IndexingAction)
                    {
                    case IndexingAction.RemoveTracks:
                        this.IsIndexerRemovingSongs   = true;
                        this.IsIndexerAddingSongs     = false;
                        this.IsIndexerUpdatingSongs   = false;
                        this.IsIndexerUpdatingArtwork = false;
                        this.IndexingProgress         = string.Empty;
                        break;

                    case IndexingAction.AddTracks:
                        this.IsIndexerRemovingSongs   = false;
                        this.IsIndexerAddingSongs     = true;
                        this.IsIndexerUpdatingSongs   = false;
                        this.IsIndexerUpdatingArtwork = false;
                        this.IndexingProgress         = this.FillProgress(indexingStatusEventArgs.ProgressCurrent.ToString(), indexingStatusEventArgs.ProgressTotal.ToString());
                        break;

                    case IndexingAction.UpdateTracks:
                        this.IsIndexerRemovingSongs   = false;
                        this.IsIndexerAddingSongs     = false;
                        this.IsIndexerUpdatingSongs   = true;
                        this.IsIndexerUpdatingArtwork = false;
                        this.IndexingProgress         = this.FillProgress(indexingStatusEventArgs.ProgressCurrent.ToString(), indexingStatusEventArgs.ProgressTotal.ToString());
                        break;

                    case IndexingAction.UpdateArtwork:
                        this.IsIndexerRemovingSongs   = false;
                        this.IsIndexerAddingSongs     = false;
                        this.IsIndexerUpdatingSongs   = false;
                        this.IsIndexerUpdatingArtwork = true;
                        this.IndexingProgress         = string.Empty;
                        break;

                    default:
                        break;
                        // Never happens
                    }
                }
                else
                {
                    this.IndexingProgress = string.Empty;

                    if (SettingsClient.Get <bool>("Updates", "CheckForUpdates"))
                    {
                        this.updateService.EnableUpdateCheck();
                    }
                }
            });
        }
Example #2
0
        private async Task IndexingService_IndexingStatusChangedAsync(IndexingStatusEventArgs indexingStatusEventArgs)
        {
            await Task.Run(() =>
            {
                this.IsIndexing = this.indexingService.IsIndexing;

                if (this.IsIndexing)
                {
                    this.updateService.DisableUpdateCheck();
                    this.IsUpdateAvailable = false;

                    switch (indexingStatusEventArgs.IndexingAction)
                    {
                    case IndexingAction.RemoveTracks:
                        this.IsIndexerRemovingSongs   = true;
                        this.IsIndexerAddingSongs     = false;
                        this.IsIndexerUpdatingSongs   = false;
                        this.IsIndexerUpdatingArtwork = false;
                        this.IndexingProgress         = string.Empty;
                        break;

                    case IndexingAction.AddTracks:
                        this.IsIndexerRemovingSongs   = false;
                        this.IsIndexerAddingSongs     = true;
                        this.IsIndexerUpdatingSongs   = false;
                        this.IsIndexerUpdatingArtwork = false;
                        this.IndexingProgress         = "(" + ResourceUtils.GetStringResource("Language_Current_Of_Total") + ")";
                        this.IndexingProgress         = this.IndexingProgress.Replace("%current%", indexingStatusEventArgs.ProgressCurrent.ToString());
                        this.IndexingProgress         = this.IndexingProgress.Replace("%total%", indexingStatusEventArgs.ProgressTotal.ToString());
                        break;

                    case IndexingAction.UpdateTracks:
                        this.IsIndexerRemovingSongs   = false;
                        this.IsIndexerAddingSongs     = false;
                        this.IsIndexerUpdatingSongs   = true;
                        this.IsIndexerUpdatingArtwork = false;
                        this.IndexingProgress         = "(" + ResourceUtils.GetStringResource("Language_Current_Of_Total") + ")";
                        this.IndexingProgress         = this.IndexingProgress.Replace("%current%", indexingStatusEventArgs.ProgressCurrent.ToString());
                        this.IndexingProgress         = this.IndexingProgress.Replace("%total%", indexingStatusEventArgs.ProgressTotal.ToString());
                        break;

                    case IndexingAction.UpdateArtwork:
                        this.IsIndexerRemovingSongs   = false;
                        this.IsIndexerAddingSongs     = false;
                        this.IsIndexerUpdatingSongs   = false;
                        this.IsIndexerUpdatingArtwork = true;
                        this.IndexingProgress         = string.Empty;
                        break;

                    default:
                        break;
                        // Never happens
                    }
                }
                else
                {
                    this.IndexingProgress = string.Empty;

                    if (XmlSettingsClient.Instance.Get <bool>("Updates", "CheckForUpdates"))
                    {
                        this.updateService.EnableUpdateCheck();
                    }
                }
            });
        }