private async Task ViewModelOnCancelingAsync(object sender, CancelingEventArgs e) { _closingViewModel = new ProgressWindowViewModel(); _closingViewModel.Title = "Cancelling..."; _closingViewModel.SetOwnerWindow(this); _visualizerService.ShowDialogAsync(_closingViewModel); }
public void Run(Func <IProgress, Task> action) { var vm = new ProgressWindowViewModel { Action = action }; var window = new ProgressWindow { DataContext = vm }; window.ShowDialog(); }
public ProgressDialog(Window parentWindow, string title, string text, int maxProgress = 0) { _cancellationTokenSource = new CancellationTokenSource(); _progressAccumulator = new ProgressAccumulator(i => _viewModel.Progress = i); _maxProgress = new Progress <int>(i => _viewModel.MaxProgress = i); _viewModel = new ProgressWindowViewModel { Title = title, Text = text, Progress = 0, MaxProgress = maxProgress, ShowProgressNumber = true, }; _window = new ProgressWindow { DataContext = _viewModel, Owner = parentWindow }; _window.Closed += WindowOnClosed; }
public static void Load(ProgressWindowViewModel windowViewModel) { System.Threading.Thread thread = new Thread(DataService.LoadData); thread.Start(windowViewModel); }