Esempio n. 1
0
        private void OnEraseComplete(object sender, RunWorkerCompletedEventArgs e)
        {
            BackgroundOperations.MusicEraseResult result = (BackgroundOperations.MusicEraseResult)e.Result;

            BackgroundOperations.LogResult(result.Result, result.ErrorMessage);

            switch (result.Result)
            {
            case BackgroundOperations.OperationResult.Canceled:
            case BackgroundOperations.OperationResult.Failed:
                return;

            case BackgroundOperations.OperationResult.SucceededWithWarnings:
            case BackgroundOperations.OperationResult.SucceededWithErrors:
                if (Utils.ShowQuestion(null, msgContinueAfterProblems, MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }
                break;
            }

            // Start to convert.
            Logger.WriteLine("Convert new and changed files...");

            // Create a worker and show the conversion progress.
            BackgroundWorker worker = BackgroundOperations.CreateMusicConverter();

            worker.RunWorkerCompleted += OnConvertComplete;
            worker.RunWorkerAsync(new BackgroundOperations.MusicConvertArguments(comparer));
        }
Esempio n. 2
0
        public void DoCompare()
        {
            Logger.WriteLine("Compare folders...");

            // Create a worker and show the conversion progress.
            BackgroundWorker worker = BackgroundOperations.CreateComparer();

            worker.RunWorkerCompleted += OnCompareComplete;
            worker.RunWorkerAsync(new BackgroundOperations.CompareArguments(sourceFolder, targetFolder, playlists));
        }
Esempio n. 3
0
        private void OnCompareComplete(object sender, RunWorkerCompletedEventArgs e)
        {
            BackgroundOperations.CompareResult result = (BackgroundOperations.CompareResult)e.Result;

            BackgroundOperations.LogResult(result.Result, result.ErrorMessage);

            comparer = result.Comparer;

            if (OnCompared != null)
            {
                OnCompared(this, EventArgs.Empty);
            }
        }
Esempio n. 4
0
        public void DoConvert()
        {
            if (comparer == null)
            {
                Logger.WriteLine("Before a conversion you must perform a comparison.");
                return;
            }

            Logger.WriteLine("Erase obsolete and changed files...");

            // Create a worker and show the conversion progress.
            BackgroundWorker worker = BackgroundOperations.CreateMusicEraser();

            worker.RunWorkerCompleted += OnEraseComplete;
            worker.RunWorkerAsync(new BackgroundOperations.MusicEraseArguments(
                                      comparer.Songs.Where(s => s.State == SongState.Changed || s.State == SongState.Deleted)));
        }