public FileOpenerService(IOpenedFileService openedFileService, ILoggerFactory loggerFactory, IAppSettings appSettings, IFileLoader fileLoader, IBackgroundTaskService backgroundTaskService) { _openedFileService = openedFileService ?? throw new ArgumentNullException(nameof(openedFileService)); _appSettings = appSettings ?? throw new ArgumentNullException(nameof(appSettings)); _fileLoader = fileLoader ?? throw new ArgumentNullException(nameof(fileLoader)); _backgroundTaskService = backgroundTaskService ?? throw new ArgumentNullException(nameof(backgroundTaskService)); _logger = loggerFactory.CreateLogger(this.GetType()); }
public CloseFileCommand(IOpenedFileService openedFileService) { _openedFileService = openedFileService ?? throw new ArgumentNullException(nameof(openedFileService)); _openedFileService.OpenedFileChanged += (sender, args) => { TriggerCanExecuteChanged(); }; }
public OpenTitleWebPageCommand(IOpenedFileService openedFileService, IAppSettings appSettings, ILoggerFactory loggerFactory) { _openedFileService = openedFileService ?? throw new ArgumentNullException(nameof(openedFileService)); _appSettings = appSettings ?? throw new ArgumentNullException(nameof(appSettings)); _logger = (loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory))).CreateLogger(this.GetType()); _openedFileService.OpenedFileChanged += (_, _) => // (_, _) == An ass ? { UpdateCnmtItem(); }; UpdateCnmtItem(); }
public MainWindowViewModel( ILoggerFactory loggerFactory, IOpenedFileService openedFileService, IOpenFileCommand openFileCommand, IOpenLastFileCommand openLastFileCommand, ICloseFileCommand closeFileCommand, IExitAppCommand exitAppCommand, IShowSettingsViewCommand showSettingsViewCommand, IVerifyNcasHeaderSignatureCommand verifyNcasHeaderSignatureCommand, IVerifyNcasHashCommand verifyNcasHashCommand, ILoadKeysCommand loadKeysCommand, IOpenTitleWebPageCommand openTitleWebPageCommand, IFileOpenerService fileOpenerService, IServiceProvider serviceProvider, ILogSource logSource, IBackgroundTaskService backgroundTaskService) { _logger = (loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory))).CreateLogger(this.GetType()); _fileOpenerService = fileOpenerService ?? throw new ArgumentNullException(nameof(fileOpenerService)); _openedFileService = openedFileService ?? throw new ArgumentNullException(nameof(openedFileService)); OpenFileCommand = openFileCommand ?? throw new ArgumentNullException(nameof(openFileCommand)); ExitAppCommand = exitAppCommand ?? throw new ArgumentNullException(nameof(exitAppCommand)); ShowSettingsViewCommand = showSettingsViewCommand ?? throw new ArgumentNullException(nameof(showSettingsViewCommand)); VerifyNcasHeaderSignatureCommand = verifyNcasHeaderSignatureCommand ?? throw new ArgumentNullException(nameof(verifyNcasHeaderSignatureCommand)); VerifyNcasHashCommand = verifyNcasHashCommand ?? throw new ArgumentNullException(nameof(verifyNcasHashCommand)); LoadKeysCommand = loadKeysCommand ?? throw new ArgumentNullException(nameof(loadKeysCommand)); ServiceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); LogSource = logSource ?? throw new ArgumentNullException(nameof(logSource)); BackgroundTask = backgroundTaskService ?? throw new ArgumentNullException(nameof(backgroundTaskService)); OpenLastFileCommand = openLastFileCommand ?? throw new ArgumentNullException(nameof(openLastFileCommand)); CloseFileCommand = closeFileCommand ?? throw new ArgumentNullException(nameof(closeFileCommand)); OpenTitleWebPageCommand = openTitleWebPageCommand ?? throw new ArgumentNullException(nameof(closeFileCommand)); var assemblyName = Assembly.GetExecutingAssembly().GetName(); var assemblyVersion = (assemblyName.Version ?? new Version()); _appNameAndVersion = $"{assemblyName.Name} v{assemblyVersion.Major}.{assemblyVersion.Minor}.{assemblyVersion.Revision}"; UpdateTitle(); _openedFileService.OpenedFileChanged += OnOpenedFileChanged; LogSource.Log += OnLog; _animationDurationTimer = new Timer(3000); _animationDurationTimer.Elapsed += OnAnimationDurationTimerElapsed; }
public VerifyNcasHeaderSignatureCommand(IOpenedFileService openedFileService, IBackgroundTaskService backgroundTaskService, IServiceProvider serviceProvider) { _openedFileService = openedFileService ?? throw new ArgumentNullException(nameof(openedFileService)); _backgroundTaskService = backgroundTaskService ?? throw new ArgumentNullException(nameof(backgroundTaskService)); _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); _openedFileService.OpenedFileChanged += (sender, args) => { TriggerCanExecuteChanged(); }; _backgroundTaskService.PropertyChanged += (sender, args) => { if (args.PropertyName == nameof(IBackgroundTaskService.IsRunning)) { TriggerCanExecuteChanged(); } }; }