Exemplo n.º 1
0
 private async Task ViewModelOnCancelingAsync(object sender, CancelingEventArgs e)
 {
     _closingViewModel       = new ProgressWindowViewModel();
     _closingViewModel.Title = "Cancelling...";
     _closingViewModel.SetOwnerWindow(this);
     _visualizerService.ShowDialogAsync(_closingViewModel);
 }
Exemplo n.º 2
0
        public void Run(Func <IProgress, Task> action)
        {
            var vm = new ProgressWindowViewModel {
                Action = action
            };
            var window = new ProgressWindow {
                DataContext = vm
            };

            window.ShowDialog();
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
 public static void Load(ProgressWindowViewModel windowViewModel)
 {
     System.Threading.Thread thread = new Thread(DataService.LoadData);
     thread.Start(windowViewModel);
 }