Пример #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);
 }
 /// <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);
 }