public OptionsModel( ISettingsFaultFinder faultFinder, IOptionTasks optionTasks, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, Contracts.Options data, GeneralOptions generalOptions, IProfileType profileType, bool isGoogle, OptionModelSessionData sessionData) { if (data == null) { throw new ArgumentNullException(nameof(data)); } _mappingConfigurationModelFactory = new MappingConfigurationModelFactory(sessionData); _faultFinder = faultFinder ?? throw new ArgumentNullException(nameof(faultFinder)); _optionTasks = optionTasks ?? throw new ArgumentNullException(nameof(optionTasks)); _outlookAccountPasswordProvider = outlookAccountPasswordProvider ?? throw new ArgumentNullException(nameof(outlookAccountPasswordProvider)); _generalOptions = generalOptions ?? throw new ArgumentNullException(nameof(generalOptions)); ProfileType = profileType ?? throw new ArgumentNullException(nameof(profileType)); _sessionData = sessionData ?? throw new ArgumentNullException(nameof(sessionData)); Id = data.Id; _isGoogle = isGoogle; InitializeData(data); }
public IOptionsViewModel AddMultipleHeadless(IProfileType type) { var profileModelFactoryFactory = _profileModelFactoriesByType[type]; var viewModel = profileModelFactoryFactory.CreateTemplateViewModel(); _options.Add(viewModel); return(viewModel); }
public ProfileViewModel(IProfileType profileType) { if (profileType == null) { throw new ArgumentNullException(nameof(profileType)); } ProfileType = profileType; Name = profileType.Name; ImageUrl = profileType.ImageUrl; }
public static string GetProfileTypeName(IProfileType type) { var typeNameWithSuffix = type.GetType().Name; const string profileSuffix = "Profile"; if (!typeNameWithSuffix.EndsWith(profileSuffix) || typeNameWithSuffix.Length == profileSuffix.Length) { throw new ArgumentException($"Type name has to have at least one character with the suffix '{profileSuffix}'", nameof(type)); } var typeName = typeNameWithSuffix.Substring(0, typeNameWithSuffix.Length - profileSuffix.Length); return(typeName); }
protected ProfileModelFactoryBase(IProfileType profileType, IOptionsViewModelParent optionsViewModelParent, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList <string> availableCategories, IOptionTasks optionTasks, ISettingsFaultFinder settingsFaultFinder, GeneralOptions generalOptions, IViewOptions viewOptions, OptionModelSessionData sessionData) { if (profileType == null) { throw new ArgumentNullException(nameof(profileType)); } if (optionsViewModelParent == null) { throw new ArgumentNullException(nameof(optionsViewModelParent)); } if (outlookAccountPasswordProvider == null) { throw new ArgumentNullException(nameof(outlookAccountPasswordProvider)); } if (availableCategories == null) { throw new ArgumentNullException(nameof(availableCategories)); } if (optionTasks == null) { throw new ArgumentNullException(nameof(optionTasks)); } if (settingsFaultFinder == null) { throw new ArgumentNullException(nameof(settingsFaultFinder)); } if (generalOptions == null) { throw new ArgumentNullException(nameof(generalOptions)); } if (viewOptions == null) { throw new ArgumentNullException(nameof(viewOptions)); } if (sessionData == null) { throw new ArgumentNullException(nameof(sessionData)); } ProfileType = profileType; OptionsViewModelParent = optionsViewModelParent; OutlookAccountPasswordProvider = outlookAccountPasswordProvider; AvailableCategories = availableCategories; OptionTasks = optionTasks; SettingsFaultFinder = settingsFaultFinder; GeneralOptions = generalOptions; ViewOptions = viewOptions; SessionData = sessionData; ServerSettingsDetector = new Lazy <IServerSettingsDetector>(CreateServerSettingsDetector); }
public ColorMappingDataAccess(IOptionDataAccess optionDataAccess, IProfileType profileType) { if (optionDataAccess == null) { throw new ArgumentNullException(nameof(optionDataAccess)); } if (profileType == null) { throw new ArgumentNullException(nameof(profileType)); } _optionDataAccess = optionDataAccess; _profileType = profileType; }
void Close(bool okPressed) { if (okPressed) { if (ProfileTypes.Count(p => p.IsSelected) != 1) { _uiService.ShowErrorDialog("Please select exactly one option.", ComponentContainer.MessageBoxTitle); return; } SelectedProfile = ProfileTypes.Single(p => p.IsSelected).ProfileType; } CloseRequested?.Invoke(this, new CloseEventArgs(okPressed)); }
public OptionsModel( ISettingsFaultFinder faultFinder, IOptionTasks optionTasks, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, Contracts.Options data, GeneralOptions generalOptions, IProfileType profileType, bool isGoogle) { if (data == null) { throw new ArgumentNullException(nameof(data)); } if (faultFinder == null) { throw new ArgumentNullException(nameof(faultFinder)); } if (optionTasks == null) { throw new ArgumentNullException(nameof(optionTasks)); } if (outlookAccountPasswordProvider == null) { throw new ArgumentNullException(nameof(outlookAccountPasswordProvider)); } if (generalOptions == null) { throw new ArgumentNullException(nameof(generalOptions)); } if (profileType == null) { throw new ArgumentNullException(nameof(profileType)); } _faultFinder = faultFinder; _optionTasks = optionTasks; _outlookAccountPasswordProvider = outlookAccountPasswordProvider; _generalOptions = generalOptions; ProfileType = profileType; Id = data.Id; _isGoogle = isGoogle; InitializeData(data); }
void Close(bool okPressed) { if (okPressed) { if (ProfileTypes.Count(p => p.IsSelected) != 1) { _uiService.ShowErrorDialog(Strings.Get($"Please select exactly one option."), ComponentContainer.MessageBoxTitle); return; } if (StringComparer.InvariantCultureIgnoreCase.Equals(ProfileTypes.Single(p => p.IsSelected).ProfileType.Name, "Open-Xchange")) { _uiService.ShowOXInfoDialog(); return; } SelectedProfile = ProfileTypes.Single(p => p.IsSelected).ProfileType; } CloseRequested?.Invoke(this, new CloseEventArgs(okPressed)); }
public ProfileModelFactory(IProfileType profileType, IOptionsViewModelParent optionsViewModelParent, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList <string> availableCategories, IOptionTasks optionTasks, GeneralOptions generalOptions, IViewOptions viewOptions, OptionModelSessionData sessionData) : base(profileType, optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, generalOptions, viewOptions, sessionData) { }