예제 #1
0
 /// <summary>
 ///   Search the storage for duplicate files
 /// </summary>
 private void FindDuplicates()
 {
     HashSet <TrackData>[] duplicates = null;
     Task.Factory.StartNew(
         () =>
     {
         duplicates = duplicatesDetectorFacade.FindAllDuplicates(
             (track, total, current) =>
         {
             CurrentProgress = (int)Math.Ceiling((float)current / total * 100);
             if (current >= total)
             {
                 processedMusicItems = current;         /*set processed unit items*/
                 CurrentProgress     = 0;
             }
         });
     }).ContinueWith(     /*Update the UI*/
         task =>
     {
         ProcessingStep         = SetpGeneratingReport;
         ReportViewModel report = new ReportViewModel {
             Sets = duplicates
         };
         GenericViewModel viewModel = new GenericViewModel();
         viewModel.Workspaces.Add(report);
         IGenericViewWindow view       = GetService <IGenericViewWindow>();
         IWindowService windowMediator = GetService <IWindowService>();
         windowMediator.ShowDialog(view, viewModel, (o, args) => report.StopPlaying());
         ProcessingStep = StepSelectRootFolder;
         IsProcessing   = false;
     },
         TaskScheduler);
 }
        public void ShowDialog <TViewModel>(IGenericViewWindow view, TViewModel viewModel, Action <object, EventArgs> onDialogClose)
        {
            view.DataContext = viewModel;
            if (onDialogClose != null)
            {
                view.Closing += (o, args) => onDialogClose(o, args);
            }

            view.Show();
        }
 public void ShowDialog <TViewModel>(IGenericViewWindow view, TViewModel viewModel)
 {
     ShowDialog(view, viewModel, null);
 }