Exemplo n.º 1
0
        public MainViewModel(
            IAmalgamationManagementService iAmalgamationManagementService,
            IMessengerService messengerService,
            IWindowService windowService,
            IDialogInteractionService dialogInteractionService,
            IWindowsProcessService windowsProcessService,
            ISettingsService settingsService,
            ILogger logger)
        {
            _amalgamationManagementService = iAmalgamationManagementService;
            _messengerService         = messengerService;
            _windowService            = windowService;
            _dialogInteractionService = dialogInteractionService;
            _messengerService.Register <TaskProgressMessage>(this, HandleTaskProgressMessage);
            _messengerService.Register <AmalgamationSummary>(this, x => AmalgamationSummary = x);
            _windowsProcessService = windowsProcessService;
            _settingsService       = settingsService;
            _logger = logger;

            ChooseFileCommand         = new RelayCommand(ShowChooseFileDialog);
            AmalgamateFilesCommand    = new AsyncCommand(AmalgamateFiles, () => CanMerge);
            OutputDirectoryCommand    = new RelayCommand(() => ProcessStart(OutputDirectory));
            SettingsNavigationCommand = new RelayCommand(SettingsNavigate);
            AboutNavigationCommand    = new RelayCommand(AboutNavigate);
            RemoveFileCommand         = new RelayCommand <object>(RemoveFile);

            MergeAnotherSetOfFilesCommand = new RelayCommand(() => CurrentStage = StageKeys.ChooseFile);
            CancelCommand = new RelayCommand(Cancel, () => (CurrentStage == StageKeys.Processing) && (!_cancellationTokenSource?.IsCancellationRequested ?? false));
        }
Exemplo n.º 2
0
 private MainViewModel NewViewModel(
     IIlrDesktopService ilrDesktopService         = null,
     IDesktopContextFactory desktopContextFactory = null,
     IMessengerService messengerService           = null,
     IWindowService windowService = null,
     IDialogInteractionService dialogInteractionService          = null,
     IWindowsProcessService windowsProcessService                = null,
     IReleaseVersionInformationService versionInformationService = null,
     IReferenceDataVersionInformationService referenceDataVersionInformationService = null,
     ILogger logger = null,
     IFeatureSwitchService featureSwitchService     = null,
     IVersionMediatorService versionMediatorService = null,
     IDesktopReferenceDataDownloadService desktopReferenceDataDownloadService = null)
 {
     return(new MainViewModel(
                ilrDesktopService ?? Mock.Of <IIlrDesktopService>(),
                desktopContextFactory ?? Mock.Of <IDesktopContextFactory>(),
                messengerService ?? Mock.Of <IMessengerService>(),
                windowService ?? Mock.Of <IWindowService>(),
                dialogInteractionService ?? Mock.Of <IDialogInteractionService>(),
                windowsProcessService ?? Mock.Of <IWindowsProcessService>(),
                versionInformationService ?? Mock.Of <IReleaseVersionInformationService>(),
                referenceDataVersionInformationService ?? Mock.Of <IReferenceDataVersionInformationService>(),
                logger ?? Mock.Of <ILogger>(),
                featureSwitchService ?? Mock.Of <IFeatureSwitchService>(),
                versionMediatorService ?? Mock.Of <IVersionMediatorService>(),
                desktopReferenceDataDownloadService ?? Mock.Of <IDesktopReferenceDataDownloadService>()));
 }
        public SettingsViewModel(ISettingsService settingsService, IDialogInteractionService dialogInteractionService)
        {
            _dialogInteractionService = dialogInteractionService;
            _settingsService          = settingsService;

            _outputDirectory = settingsService.OutputDirectory;

            ChooseOutputDirectoryCommand = new RelayCommand(ChooseOutputDirectory);
            SaveSettingsCommand          = new AsyncCommand <ICloseable>(SaveSettings, CanSave);
            CloseWindowCommand           = new RelayCommand <ICloseable>(CloseWindow);
        }
        public SettingsViewModel(
            IDesktopServiceSettings desktopServiceSettings,
            IDialogInteractionService dialogInteractionService,
            IConnectivityService connectivityService)
        {
            _dialogInteractionService = dialogInteractionService;
            _connectivityService      = connectivityService;
            _desktopServiceSettings   = desktopServiceSettings;

            ChooseOutputDirectoryCommand = new RelayCommand(ChooseOutputDirectory);
            SaveSettingsCommand          = new AsyncCommand <ICloseable>(SaveSettings, CanSave);
            CloseWindowCommand           = new RelayCommand <ICloseable>(CloseWindow);
            TestConnectionStringCommand  = new AsyncCommand(TestConnectionString, CanTestConnectionString);

            _ilrDatabaseConnectionString = _desktopServiceSettings.IlrDatabaseConnectionString;
            _outputDirectory             = _desktopServiceSettings.OutputDirectory;
            _exportToSql          = _desktopServiceSettings.ExportToSql;
            _exportToAccessAndCsv = _desktopServiceSettings.ExportToAccessAndCsv;
        }
Exemplo n.º 5
0
        public MainViewModel(
            IIlrDesktopService ilrDesktopService,
            IDesktopContextFactory desktopContextFactory,
            IMessengerService messengerService,
            IWindowService windowService,
            IDialogInteractionService dialogInteractionService,
            IWindowsProcessService windowsProcessService,
            IReleaseVersionInformationService versionInformationService,
            IReferenceDataVersionInformationService refDataVersionInformationService,
            ILogger logger,
            IFeatureSwitchService featureSwitchService,
            IVersionMediatorService versionMediatorService,
            IDesktopReferenceDataDownloadService desktopReferenceDataDownloadService)
        {
            _ilrDesktopService         = ilrDesktopService;
            _desktopContextFactory     = desktopContextFactory;
            _windowService             = windowService;
            _dialogInteractionService  = dialogInteractionService;
            _windowsProcessService     = windowsProcessService;
            _versionInformationService = versionInformationService;
            _logger = logger;
            _featureSwitchService                = featureSwitchService;
            _versionMediatorService              = versionMediatorService;
            _refDataVersionInformationService    = refDataVersionInformationService;
            _desktopReferenceDataDownloadService = desktopReferenceDataDownloadService;
            _referenceDataVersionNumber          = _refDataVersionInformationService.VersionNumber;

            messengerService.Register <TaskProgressMessage>(this, HandleTaskProgressMessage);

            CheckForUpdateCommand     = new AsyncCommand(CheckForNewVersion, CanCheckForNewVersion);
            CheckForUpdateMenuCommand = new AsyncCommand(CheckForNewVersionFromMenu, CanCheckForNewVersion);

            ChooseFileCommand              = new RelayCommand(ShowChooseFileDialog);
            ProcessFileCommand             = new AsyncCommand(ProcessFile, () => CanSubmit);
            SettingsNavigationCommand      = new RelayCommand(SettingsNavigate);
            AboutNavigationCommand         = new RelayCommand(AboutNavigate);
            ReportFiltersNavigationCommand = new RelayCommand(ReportFiltersNavigate);
            ReportsFolderCommand           = new RelayCommand(() => ProcessStart(_reportsLocation));
            CancelAndReImportCommand       = new RelayCommand(CancelAndReImport, () => !_cancellationTokenSource?.IsCancellationRequested ?? false);
            VersionNavigationCommand       = new RelayCommand(NavigateToVersionsUrl);
            ReferenceDataDownloadCommand   = new AsyncCommand(DownloadReferenceData);
        }
 private SettingsViewModel NewViewModel(IDesktopServiceSettings desktopServiceSettings = null, IDialogInteractionService dialogInteractionService = null, IConnectivityService connectivityService = null)
 {
     return(new SettingsViewModel(
                desktopServiceSettings ?? Mock.Of <IDesktopServiceSettings>(),
                dialogInteractionService ?? Mock.Of <IDialogInteractionService>(),
                connectivityService ?? Mock.Of <IConnectivityService>()));
 }