public ResultsSavingController(
            ResultsSavingViewModel viewModel, 
            IFileSystem fs,
            CommonServices svc,
            XmlResultsGenerator generator)
        {
            _viewModel = viewModel;
            _fs = fs;
            _svc = svc;
            _generator = generator;



            _viewModel.CommandSaveResults = new SmartCommand(async () =>
            {
                try
                {
                    await SaveResults();
                }
                catch (OperationCanceledException e)
                {
                    Close();
                }
                catch (Exception e)
                {
                    _log.Error(e);
                }
            },
                canExecute: () => !_viewModel.SavingInProgress)
                .UpdateOnChanged(_viewModel, _ => _.SavingInProgress);

            _viewModel.CommandClose = new SmartCommand(() =>
            {
                if(_cts != null)
                {
                    _cts.Cancel();
                    _viewModel.IsCancelled = true;
                }
                else
                {
                    Close();
                }
            },
                canExecute: () => !_viewModel.IsCancelled)
                .UpdateOnChanged(_viewModel, _ => _.IsCancelled);

            _viewModel.CommandBrowse = new SmartCommand(BrowsePath, 
                canExecute: () => !_viewModel.SavingInProgress)
                .UpdateOnChanged(_viewModel, _ => _.SavingInProgress);

            if (_svc.Settings.ContainsKey("MutationResultsFilePath"))
            {
                _viewModel.TargetPath = _svc.Settings["MutationResultsFilePath"];
            }
           
        }
        public ResultsSavingController(
            ResultsSavingViewModel viewModel,
            IFileSystem fs,
            CommonServices svc,
            XmlResultsGenerator generator)
        {
            _viewModel = viewModel;
            _fs        = fs;
            _svc       = svc;
            _generator = generator;



            _viewModel.CommandSaveResults = new SmartCommand(async() =>
            {
                try
                {
                    await SaveResults();
                }
                catch (OperationCanceledException e)
                {
                    Close();
                }
                catch (Exception e)
                {
                    _log.Error(e);
                }
            },
                                                             canExecute: () => !_viewModel.SavingInProgress)
                                            .UpdateOnChanged(_viewModel, _ => _.SavingInProgress);

            _viewModel.CommandClose = new SmartCommand(() =>
            {
                if (_cts != null)
                {
                    _cts.Cancel();
                    _viewModel.IsCancelled = true;
                }
                else
                {
                    Close();
                }
            },
                                                       canExecute: () => !_viewModel.IsCancelled)
                                      .UpdateOnChanged(_viewModel, _ => _.IsCancelled);

            _viewModel.CommandBrowse = new SmartCommand(BrowsePath,
                                                        canExecute: () => !_viewModel.SavingInProgress)
                                       .UpdateOnChanged(_viewModel, _ => _.SavingInProgress);

            if (_svc.Settings.ContainsKey("MutationResultsFilePath"))
            {
                _viewModel.TargetPath = _svc.Settings["MutationResultsFilePath"];
            }
        }