private async void StartCleaning(ProgressBar progressBar, DialogSession session) { var callback = new Progress <int>( i => { progressBar.Dispatcher.BeginInvoke(new Action(() => { progressBar.Value = i; })); }); var result = await cleanerService.CleanAsync(currentResult, callback); if (result.Failures.Count > 0) { await progressBar.Dispatcher.BeginInvoke(new Action(() => { var failuresDialog = new FailuresDialog { FailuresListBox = { ItemsSource = result.Failures } }; session.UpdateContent(failuresDialog); })); } else { await progressBar.Dispatcher.BeginInvoke(new Action(session.Close)); } CanRefresh = true; await RunRefresh(); }
private async void StartCleaning(ProgressBar progressBar, DialogSession session) { var callback = new Progress<int>( i => { progressBar.Dispatcher.BeginInvoke(new Action(() => { progressBar.Value = i; })); }); var result = await cleanerService.CleanAsync(currentResult, callback); if (result.Failures.Count > 0) await progressBar.Dispatcher.BeginInvoke(new Action(() => { var failuresDialog = new FailuresDialog {FailuresListBox = {ItemsSource = result.Failures}}; session.UpdateContent(failuresDialog); })); else await progressBar.Dispatcher.BeginInvoke(new Action(session.Close)); CanRefresh = true; await RunRefresh(); }