private async Task CopySettingsAsync(ISettingsMapper mapper, ISettingsService source, ISettingsService target) { var sourceSettings = await source.LoadAsync(); var targetSettings = await target.LoadAsync(); mapper.Map(sourceSettings, targetSettings); await target.SaveAsync(targetSettings); }
public SettingsController(ISettingsMapper mapper, IEstimateStatusService estimateStatusService, IInmateUnitService inmateUnitService, IInvoiceStatusService invoiceStatusService, IPaymentMethodService paymentMethodService, IProductCategoryService productCategoryService, IProductService productService, ITaxRateService taxRateService, IUserService userService) { _mapper = mapper; _estimateStatusService = estimateStatusService; _inmateUnitService = inmateUnitService; _invoiceStatusService = invoiceStatusService; _paymentMethodService = paymentMethodService; _productCategoryService = productCategoryService; _productService = productService; _taxRateService = taxRateService; _userService = userService; }
public MainWindowViewModel ( IKeyAwaiter keyAwaiter, IApplicationSettingsRepository applicationSettingsRepository, ISettingsMapper settingsMapper, ITacticalCameraServiceFactory tacticalCameraServiceFactory ) { _keyAwaiter = keyAwaiter; _applicationSettingsRepository = applicationSettingsRepository; _settingsMapper = settingsMapper; ApplicationSettings settings = GetApplicationSettings(); RestoreSettings(settings); TacticalCameraSettings tacticalCameraSettings = _settingsMapper.MapToTacticalCameraSettings(settings); _tacticalCameraService = tacticalCameraServiceFactory.CreateTacticalCameraService(tacticalCameraSettings); _tacticalCameraService.ProcessStatusChanged += OnTacticalCameraServiceOnProcessStatusChanged; _tacticalCameraService.WaitAndAttachToProcess(); }
private async Task InitializeSettingsAsync() { settingsMapper = new ManualSettingsMapper(); if (String.IsNullOrEmpty(Configuration.Default.Path) || !File.Exists(Configuration.Default.Path)) { Configuration.Default.Path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "SolutionRunner.json"); #if DEBUG if (true) #else if (!ApplicationDeployment.CurrentDeployment.IsFirstRun) #endif { MessageBox.Show( "Unfortunately, we have lost your configuration file (or, if you see this message for the first time, we are going to upgrade from previous version)." + Environment.NewLine + "More information can be found in configuration -> Import and Export.", "SolutionRunner" ); } if (!File.Exists(Configuration.Default.Path)) { await CopySettingsAsync( settingsMapper, new DefaultSettingsService(), new JsonSettingsService(() => Configuration.Default.Path) ); } Configuration.Default.Save(); } settingsService = new JsonSettingsService(() => Configuration.Default.Path); settings = await settingsService.LoadAsync(); }
public TaxRatesController(ITaxRateService service, ISettingsMapper mapper) { _taxRateService = service; _mapper = mapper; }
public UsersController(IUserService service, ISettingsMapper mapper) { _userService = service; _mapper = mapper; }