public GenericOptionsViewModel ( IOptionsViewModelParent parent, GeneralOptions generalOptions, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, Func<ISettingsFaultFinder, ICurrentOptions, IServerSettingsViewModel> serverSettingsViewModelFactory, Func<ICurrentOptions, IMappingConfigurationViewModelFactory> mappingConfigurationViewModelFactoryFactory, IOptionTasks optionTasks) : base (parent) { if (generalOptions == null) throw new ArgumentNullException (nameof (generalOptions)); if (outlookAccountPasswordProvider == null) throw new ArgumentNullException (nameof (outlookAccountPasswordProvider)); if (mappingConfigurationViewModelFactoryFactory == null) throw new ArgumentNullException (nameof (mappingConfigurationViewModelFactoryFactory)); _syncSettingsViewModel = new SyncSettingsViewModel(); _networkSettingsViewModel = new NetworkSettingsViewModel(); var faultFinder = generalOptions.FixInvalidSettings ? new SettingsFaultFinder (this) : NullSettingsFaultFinder.Instance; _serverSettingsViewModel = serverSettingsViewModelFactory (faultFinder, this); _generalOptions = generalOptions; _outlookAccountPasswordProvider = outlookAccountPasswordProvider; _mappingConfigurationViewModelFactory = mappingConfigurationViewModelFactoryFactory(this); _outlookFolderViewModel = new OutlookFolderViewModel (faultFinder, optionTasks); _outlookFolderViewModel.PropertyChanged += OutlookFolderViewModel_PropertyChanged; _timeRangeViewModel = new TimeRangeViewModel(); }
public static IWebDavClient CreateWebDavClient( Options options, TimeSpan timeout, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, GeneralOptions generalOptions) { if (outlookAccountPasswordProvider == null) { throw new ArgumentNullException(nameof(outlookAccountPasswordProvider)); } if (generalOptions == null) { throw new ArgumentNullException(nameof(generalOptions)); } return(CreateWebDavClient( options.UserName, options.GetEffectivePassword(outlookAccountPasswordProvider), options.CalenderUrl, timeout, options.ServerAdapterType, options.CloseAfterEachRequest, options.PreemptiveAuthentication, options.ForceBasicAuthentication, options.ProxyOptions, generalOptions.AcceptInvalidCharsInServerResponse)); }
public GenericOptionsViewModel( NameSpace session, IOptionsViewModelParent parent, bool fixInvalidSettings, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, Func <ISettingsFaultFinder, ICurrentOptions, IServerSettingsViewModel> serverSettingsViewModelFactory, Func <ICurrentOptions, IMappingConfigurationViewModelFactory> mappingConfigurationViewModelFactoryFactory) : base(parent) { if (session == null) { throw new ArgumentNullException(nameof(session)); } if (outlookAccountPasswordProvider == null) { throw new ArgumentNullException(nameof(outlookAccountPasswordProvider)); } if (mappingConfigurationViewModelFactoryFactory == null) { throw new ArgumentNullException(nameof(mappingConfigurationViewModelFactoryFactory)); } _syncSettingsViewModel = new SyncSettingsViewModel(); _networkSettingsViewModel = new NetworkSettingsViewModel(); var faultFinder = fixInvalidSettings ? new SettingsFaultFinder(this) : NullSettingsFaultFinder.Instance; _serverSettingsViewModel = serverSettingsViewModelFactory(faultFinder, this); _outlookAccountPasswordProvider = outlookAccountPasswordProvider; _mappingConfigurationViewModelFactory = mappingConfigurationViewModelFactoryFactory(this); _outlookFolderViewModel = new OutlookFolderViewModel(session, faultFinder); _outlookFolderViewModel.PropertyChanged += OutlookFolderViewModel_PropertyChanged; _timeRangeViewModel = new TimeRangeViewModel(); }
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 OptionsViewModelFactory( NameSpace session, IOptionsViewModelParent optionsViewModelParent, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList <string> availableCategories) { if (session == null) { throw new ArgumentNullException(nameof(session)); } if (optionsViewModelParent == null) { throw new ArgumentNullException(nameof(optionsViewModelParent)); } if (outlookAccountPasswordProvider == null) { throw new ArgumentNullException(nameof(outlookAccountPasswordProvider)); } if (availableCategories == null) { throw new ArgumentNullException(nameof(availableCategories)); } _optionsViewModelParent = optionsViewModelParent; _outlookAccountPasswordProvider = outlookAccountPasswordProvider; _availableCategories = availableCategories; _session = session; }
public ServerSettingsViewModel (ISettingsFaultFinder settingsFaultFinder, ICurrentOptions currentOptions, IOutlookAccountPasswordProvider outlookAccountPasswordProvider) { if (settingsFaultFinder == null) throw new ArgumentNullException (nameof (settingsFaultFinder)); if (currentOptions == null) throw new ArgumentNullException (nameof (currentOptions)); _settingsFaultFinder = settingsFaultFinder; _currentOptions = currentOptions; _outlookAccountPasswordProvider = outlookAccountPasswordProvider; _testConnectionCommand = new DelegateCommandWithoutCanExecuteDelegation (_ => { ComponentContainer.EnsureSynchronizationContext(); TestConnectionAsync(); }); _getAccountSettingsCommand = new DelegateCommandWithoutCanExecuteDelegation (_ => { ComponentContainer.EnsureSynchronizationContext(); GetAccountSettings(); }); _createDavResourceCommand = new DelegateCommandWithoutCanExecuteDelegation (_ => { ComponentContainer.EnsureSynchronizationContext(); CreateDavResource(); }); }
public OptionsCollectionViewModel( NameSpace session, bool fixInvalidSettings, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList <string> availableEventCategories, Func <Guid, string> profileDataDirectoryFactory) { _fixInvalidSettings = fixInvalidSettings; _profileDataDirectoryFactory = profileDataDirectoryFactory; if (session == null) { throw new ArgumentNullException(nameof(session)); } if (profileDataDirectoryFactory == null) { throw new ArgumentNullException(nameof(profileDataDirectoryFactory)); } _optionsViewModelFactory = new OptionsViewModelFactory( session, this, outlookAccountPasswordProvider, availableEventCategories); AddCommand = new DelegateCommand(_ => Add()); CloseCommand = new DelegateCommand(shouldSaveNewOptions => Close((bool)shouldSaveNewOptions)); }
public OptionsModel( IOptionTasks optionTasks, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, Contracts.Options data, GeneralOptions generalOptions, IProfileModelFactory profileModelFactory, bool isGoogle, OptionModelSessionData sessionData, IServerSettingsDetector serverSettingsDetector) { if (data == null) { throw new ArgumentNullException(nameof(data)); } if (serverSettingsDetector == null) { throw new ArgumentNullException(nameof(serverSettingsDetector)); } _mappingConfigurationModelFactory = new MappingConfigurationModelFactory(sessionData); _optionTasks = optionTasks ?? throw new ArgumentNullException(nameof(optionTasks)); _outlookAccountPasswordProvider = outlookAccountPasswordProvider ?? throw new ArgumentNullException(nameof(outlookAccountPasswordProvider)); _generalOptions = generalOptions ?? throw new ArgumentNullException(nameof(generalOptions)); ModelFactory = profileModelFactory ?? throw new ArgumentNullException(nameof(profileModelFactory)); _sessionData = sessionData ?? throw new ArgumentNullException(nameof(sessionData)); Id = data.Id; _isGoogle = isGoogle; _serverSettingsDetector = serverSettingsDetector; InitializeData(data); }
public OptionsDisplayControl( NameSpace session, Func <Guid, string> profileDataDirectoryFactory, bool fixInvalidSettings, IOutlookAccountPasswordProvider outlookAccountPasswordProvider) { ISettingsFaultFinder faultFinder; InitializeComponent(); if (fixInvalidSettings) { faultFinder = new SettingsFaultFinder(_syncSettingsControl); } else { faultFinder = NullSettingsFaultFinder.Instance; } _serverSettingsControl.Initialize(faultFinder, this, outlookAccountPasswordProvider); _outlookFolderControl.Initialize(session, faultFinder); _profileDataDirectoryFactory = profileDataDirectoryFactory; _profileNameTextBox.TextChanged += _profileNameTextBox_TextChanged; _inactiveCheckBox.CheckedChanged += _inactiveCheckBox_CheckedChanged; _outlookFolderControl.FolderChanged += OutlookFolderControl_FolderChanged; _configurationFormFactory = OptionTasks.CreateConfigurationFormFactory(_serverSettingsControl); }
public static IProfileTypeRegistry Create( IOptionsViewModelParent optionsViewModelParent, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList <string> availableCategories, IOptionTasks optionTasks, ISettingsFaultFinder settingsFaultFinder, GeneralOptions generalOptions, IViewOptions viewOptions) { 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)); } var generic = new GenericProfile(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions); var google = new GoogleProfile(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions); var all = new List <IProfileType> { generic, google }; all.Add(new FruuxProfile(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions)); all.Add(new PosteoProfile(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions)); all.Add(new YandexProfile(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions)); all.Add(new GmxCalendarProfile(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions)); all.Add(new SarenetProfile(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions)); all.Add(new LandmarksProfile(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions)); all.Add(new SogoProfile(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions)); all.Add(new CozyProfile(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions)); all.Add(new NextcloudProfile(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions)); all.Add(new MailboxOrgProfile(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions)); all.Add(new EasyProjectProfile(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions)); all.Add(new WebDeProfile(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions)); return(new ProfileTypeRegistry(all, generic, google)); }
public ServerSettingsViewModel(ISettingsFaultFinder settingsFaultFinder, ICurrentOptions currentOptions, IOutlookAccountPasswordProvider outlookAccountPasswordProvider) { if (settingsFaultFinder == null) { throw new ArgumentNullException(nameof(settingsFaultFinder)); } if (currentOptions == null) { throw new ArgumentNullException(nameof(currentOptions)); } _settingsFaultFinder = settingsFaultFinder; _currentOptions = currentOptions; _outlookAccountPasswordProvider = outlookAccountPasswordProvider; _testConnectionCommand = new DelegateCommandWithoutCanExecuteDelegation(_ => { ComponentContainer.EnsureSynchronizationContext(); TestConnectionAsync(); }); _getAccountSettingsCommand = new DelegateCommandWithoutCanExecuteDelegation(_ => { ComponentContainer.EnsureSynchronizationContext(); GetAccountSettings(); }); _createDavResourceCommand = new DelegateCommandWithoutCanExecuteDelegation(_ => { ComponentContainer.EnsureSynchronizationContext(); CreateDavResource(); }); }
public ServerSettingsDetector(IOutlookAccountPasswordProvider outlookAccountPasswordProvider) { if (outlookAccountPasswordProvider == null) { throw new ArgumentNullException(nameof(outlookAccountPasswordProvider)); } _outlookAccountPasswordProvider = outlookAccountPasswordProvider; }
public OptionsDisplayControlFactory( NameSpace session, Func <Guid, string> profileDataDirectoryFactory, bool fixInvalidSettings, IOutlookAccountPasswordProvider outlookAccountPasswordProvider) { _session = session; _profileDataDirectoryFactory = profileDataDirectoryFactory; _fixInvalidSettings = fixInvalidSettings; _outlookAccountPasswordProvider = outlookAccountPasswordProvider; }
public void Initialize( ISettingsFaultFinder settingsFaultFinder, IServerSettingsControlDependencies dependencies, IOutlookAccountPasswordProvider outlookAccountPasswordProvider) { InitializeComponent(); _settingsFaultFinder = settingsFaultFinder; _dependencies = dependencies; _outlookAccountPasswordProvider = outlookAccountPasswordProvider; _testConnectionButton.Click += TestConnectionButton_Click; }
public ServerSettingsTemplateViewModel(IOutlookAccountPasswordProvider outlookAccountPasswordProvider, OptionsModel prototypeModel, ProfileModelOptions modelOptions) { _outlookAccountPasswordProvider = outlookAccountPasswordProvider ?? throw new ArgumentNullException(nameof(outlookAccountPasswordProvider)); _prototypeModel = prototypeModel ?? throw new ArgumentNullException(nameof(prototypeModel)); ModelOptions = modelOptions ?? throw new ArgumentNullException(nameof(modelOptions)); RegisterPropertyChangePropagation(prototypeModel, nameof(prototypeModel.CalenderUrl), nameof(CalenderUrl)); RegisterPropertyChangePropagation(prototypeModel, nameof(prototypeModel.UserName), nameof(UserName)); RegisterPropertyChangePropagation(prototypeModel, nameof(prototypeModel.UseAccountPassword), nameof(UseAccountPassword)); RegisterPropertyChangePropagation(prototypeModel, nameof(prototypeModel.Password), nameof(Password)); RegisterPropertyChangePropagation(prototypeModel, nameof(prototypeModel.EmailAddress), nameof(EmailAddress)); }
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 OptionsForm( NameSpace session, Func <Guid, string> profileDataDirectoryFactory, bool fixInvalidSettings, IOutlookAccountPasswordProvider outlookAccountPasswordProvider) { InitializeComponent(); _optionsDisplayControlFactory = new OptionsDisplayControlFactory( session, profileDataDirectoryFactory, fixInvalidSettings, outlookAccountPasswordProvider); }
public EasyProjectServerSettingsTemplateViewModel(IOutlookAccountPasswordProvider outlookAccountPasswordProvider, OptionsModel prototypeModel) { if (prototypeModel == null) { throw new ArgumentNullException(nameof(prototypeModel)); } _outlookAccountPasswordProvider = outlookAccountPasswordProvider; _prototypeModel = prototypeModel; RegisterPropertyChangePropagation(prototypeModel, nameof(prototypeModel.CalenderUrl), nameof(CalenderUrl)); RegisterPropertyChangePropagation(prototypeModel, nameof(prototypeModel.UserName), nameof(UserName)); RegisterPropertyChangePropagation(prototypeModel, nameof(prototypeModel.UseAccountPassword), nameof(UseAccountPassword)); RegisterPropertyChangePropagation(prototypeModel, nameof(prototypeModel.Password), nameof(Password)); RegisterPropertyChangePropagation(prototypeModel, nameof(prototypeModel.EmailAddress), nameof(EmailAddress)); }
public static IWebDavClient CreateWebDavClient( Options options, TimeSpan timeout, IOutlookAccountPasswordProvider outlookAccountPasswordProvider) { return(CreateWebDavClient( options.UserName, options.GetEffectivePassword(outlookAccountPasswordProvider), options.CalenderUrl, timeout, options.ServerAdapterType, options.CloseAfterEachRequest, options.PreemptiveAuthentication, options.ForceBasicAuthentication, options.ProxyOptions)); }
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); }
public OptionsCollectionViewModel( GeneralOptions generalOptions, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList <string> availableEventCategories, Func <Guid, string> profileDataDirectoryFactory, IUiService uiService, IOptionTasks optionTasks) { _optionTasks = optionTasks; _profileDataDirectoryFactory = profileDataDirectoryFactory; _uiService = uiService; if (generalOptions == null) { throw new ArgumentNullException(nameof(generalOptions)); } if (profileDataDirectoryFactory == null) { throw new ArgumentNullException(nameof(profileDataDirectoryFactory)); } if (optionTasks == null) { throw new ArgumentNullException(nameof(optionTasks)); } _generalOptions = generalOptions; _optionsViewModelFactory = new OptionsViewModelFactory( this, outlookAccountPasswordProvider, availableEventCategories, optionTasks); AddCommand = new DelegateCommand(_ => Add()); AddMultipleCommand = new DelegateCommand(_ => AddMultiple()); CloseCommand = new DelegateCommand(shouldSaveNewOptions => Close((bool)shouldSaveNewOptions)); DeleteSelectedCommand = new DelegateCommandHandlingRequerySuggested(_ => DeleteSelected(), _ => CanDeleteSelected); CopySelectedCommand = new DelegateCommandHandlingRequerySuggested(_ => CopySelected(), _ => CanCopySelected); MoveSelectedUpCommand = new DelegateCommandHandlingRequerySuggested(_ => MoveSelectedUp(), _ => CanMoveSelectedUp); MoveSelectedDownCommand = new DelegateCommandHandlingRequerySuggested(_ => MoveSelectedDown(), _ => CanMoveSelectedDown); OpenProfileDataDirectoryCommand = new DelegateCommandHandlingRequerySuggested(_ => OpenProfileDataDirectory(), _ => CanOpenProfileDataDirectory); ExpandAllCommand = new DelegateCommandHandlingRequerySuggested(_ => ExpandAll(), _ => _options.Count > 0); CollapseAllCommand = new DelegateCommandHandlingRequerySuggested(_ => CollapseAll(), _ => _options.Count > 0); ExportAllCommand = new DelegateCommandHandlingRequerySuggested(_ => ExportAll(), _ => _options.Count > 0); ImportCommand = new DelegateCommandHandlingRequerySuggested(_ => Import(), _ => true); }
public OptionsViewModelFactory ( IOptionsViewModelParent optionsViewModelParent, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList<string> availableCategories, IOptionTasks optionTasks) { 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)); _optionsViewModelParent = optionsViewModelParent; _outlookAccountPasswordProvider = outlookAccountPasswordProvider; _availableCategories = availableCategories; _optionTasks = optionTasks; }
public SynchronizerFactory( Func <Guid, string> profileDataDirectoryFactory, ITotalProgressFactory totalProgressFactory, NameSpace outlookSession, TimeSpan calDavConnectTimeout, IDaslFilterProvider daslFilterProvider, IOutlookAccountPasswordProvider outlookAccountPasswordProvider) { if (outlookAccountPasswordProvider == null) { throw new ArgumentNullException(nameof(outlookAccountPasswordProvider)); } _outlookEmailAddress = string.Empty; try { using (var currentUser = GenericComObjectWrapper.Create(outlookSession.CurrentUser)) { if (currentUser.Inner != null) { using (var addressEntry = GenericComObjectWrapper.Create(currentUser.Inner.AddressEntry)) { if (addressEntry.Inner != null) { _outlookEmailAddress = OutlookUtility.GetEmailAdressOrNull(addressEntry.Inner, NullEntitySynchronizationLogger.Instance, s_logger) ?? string.Empty; } } } } } catch (COMException ex) { s_logger.Error("Can't access currentuser email adress.", ex); } _totalProgressFactory = totalProgressFactory; _outlookSession = outlookSession; _calDavConnectTimeout = calDavConnectTimeout; _daslFilterProvider = daslFilterProvider; _outlookAccountPasswordProvider = outlookAccountPasswordProvider; _profileDataDirectoryFactory = profileDataDirectoryFactory; }
public SynchronizerFactory( Func <Guid, string> profileDataDirectoryFactory, ITotalProgressFactory totalProgressFactory, NameSpace outlookSession, TimeSpan calDavConnectTimeout, IDaslFilterProvider daslFilterProvider, IOutlookAccountPasswordProvider outlookAccountPasswordProvider) { if (outlookAccountPasswordProvider == null) { throw new ArgumentNullException(nameof(outlookAccountPasswordProvider)); } _outlookEmailAddress = outlookSession.CurrentUser.Address; _totalProgressFactory = totalProgressFactory; _outlookSession = outlookSession; _calDavConnectTimeout = calDavConnectTimeout; _daslFilterProvider = daslFilterProvider; _outlookAccountPasswordProvider = outlookAccountPasswordProvider; _profileDataDirectoryFactory = profileDataDirectoryFactory; }
protected ProfileBase(IOptionsViewModelParent optionsViewModelParent, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList <string> availableCategories, IOptionTasks optionTasks, ISettingsFaultFinder settingsFaultFinder, GeneralOptions generalOptions, IViewOptions viewOptions) { 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)); } OptionsViewModelParent = optionsViewModelParent; OutlookAccountPasswordProvider = outlookAccountPasswordProvider; AvailableCategories = availableCategories; OptionTasks = optionTasks; SettingsFaultFinder = settingsFaultFinder; GeneralOptions = generalOptions; ViewOptions = viewOptions; }
public OptionsCollectionViewModel ( GeneralOptions generalOptions, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList<string> availableEventCategories, Func<Guid, string> profileDataDirectoryFactory, IUiService uiService, IOptionTasks optionTasks) { _optionTasks = optionTasks; _profileDataDirectoryFactory = profileDataDirectoryFactory; _uiService = uiService; if (generalOptions == null) throw new ArgumentNullException (nameof (generalOptions)); if (profileDataDirectoryFactory == null) throw new ArgumentNullException (nameof (profileDataDirectoryFactory)); if (optionTasks == null) throw new ArgumentNullException(nameof(optionTasks)); _generalOptions = generalOptions; _optionsViewModelFactory = new OptionsViewModelFactory ( this, outlookAccountPasswordProvider, availableEventCategories, optionTasks); AddCommand = new DelegateCommand (_ => Add()); AddMultipleCommand = new DelegateCommand (_ => AddMultiple()); CloseCommand = new DelegateCommand (shouldSaveNewOptions => Close((bool)shouldSaveNewOptions)); DeleteSelectedCommand = new DelegateCommandHandlingRequerySuggested (_ => DeleteSelected (), _ => CanDeleteSelected); CopySelectedCommand = new DelegateCommandHandlingRequerySuggested (_ => CopySelected (), _ => CanCopySelected); MoveSelectedUpCommand = new DelegateCommandHandlingRequerySuggested (_ => MoveSelectedUp (), _ => CanMoveSelectedUp); MoveSelectedDownCommand = new DelegateCommandHandlingRequerySuggested (_ => MoveSelectedDown (), _ => CanMoveSelectedDown); OpenProfileDataDirectoryCommand = new DelegateCommandHandlingRequerySuggested (_ => OpenProfileDataDirectory (), _ => CanOpenProfileDataDirectory); ExpandAllCommand = new DelegateCommandHandlingRequerySuggested (_ => ExpandAll (), _ => _options.Count > 0); CollapseAllCommand = new DelegateCommandHandlingRequerySuggested (_ => CollapseAll (), _ => _options.Count > 0); ExportAllCommand = new DelegateCommandHandlingRequerySuggested (_ => ExportAll (), _ => _options.Count > 0); ImportCommand = new DelegateCommandHandlingRequerySuggested (_ => Import (), _ => true); }
public OptionsCollectionViewModel( NameSpace session, GeneralOptions generalOptions, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList <string> availableEventCategories, Func <Guid, string> profileDataDirectoryFactory) { _profileDataDirectoryFactory = profileDataDirectoryFactory; if (session == null) { throw new ArgumentNullException(nameof(session)); } if (generalOptions == null) { throw new ArgumentNullException(nameof(generalOptions)); } if (profileDataDirectoryFactory == null) { throw new ArgumentNullException(nameof(profileDataDirectoryFactory)); } _generalOptions = generalOptions; _optionsViewModelFactory = new OptionsViewModelFactory( session, this, outlookAccountPasswordProvider, availableEventCategories); AddCommand = new DelegateCommand(_ => Add()); AddMultipleCommand = new DelegateCommand(_ => AddMultiple()); CloseCommand = new DelegateCommand(shouldSaveNewOptions => Close((bool)shouldSaveNewOptions)); DeleteSelectedCommand = new DelegateCommand(_ => DeleteSelected(), _ => CanDeleteSelected); CopySelectedCommand = new DelegateCommand(_ => CopySelected(), _ => CanCopySelected); MoveSelectedUpCommand = new DelegateCommand(_ => MoveSelectedUp(), _ => CanMoveSelectedUp); MoveSelectedDownCommand = new DelegateCommand(_ => MoveSelectedDown(), _ => CanMoveSelectedDown); }
public ComponentContainer(Application application, IGeneralOptionsDataAccess generalOptionsDataAccess, IComWrapperFactory comWrapperFactory, IExceptionHandlingStrategy exceptionHandlingStrategy) { if (application == null) { throw new ArgumentNullException(nameof(application)); } if (generalOptionsDataAccess == null) { throw new ArgumentNullException(nameof(generalOptionsDataAccess)); } if (comWrapperFactory == null) { throw new ArgumentNullException(nameof(comWrapperFactory)); } s_logger.Info("Startup..."); s_logger.Info($"Version: {Assembly.GetExecutingAssembly().GetName().Version}"); s_logger.Info($"Operating system: {Environment.OSVersion}"); _profileTypeRegistry = ProfileTypeRegistry.Instance; if (GeneralOptionsDataAccess.WpfRenderModeSoftwareOnly) { RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly; } _generalOptionsDataAccess = generalOptionsDataAccess; _synchronizationStatus = new SynchronizationStatus(); var generalOptions = _generalOptionsDataAccess.LoadOptions(); _daslFilterProvider = new DaslFilterProvider(generalOptions.IncludeCustomMessageClasses); SetWpfLocale(generalOptions.CultureName); ConfigureServicePointManager(generalOptions); ConfigureLogLevel(generalOptions.EnableDebugLog); _session = application.Session; _outlookAccountPasswordProvider = string.IsNullOrEmpty(_session.CurrentProfileName) ? NullOutlookAccountPasswordProvider.Instance : new OutlookAccountPasswordProvider(_session.CurrentProfileName, application.Version); _globalTimeZoneCache = new GlobalTimeZoneCache(); var applicationDataDirectoryBase = Path.Combine( Environment.GetFolderPath( generalOptions.StoreAppDataInRoamingFolder ? Environment.SpecialFolder.ApplicationData : Environment.SpecialFolder.LocalApplicationData), "CalDavSynchronizer"); string optionsFilePath; (_applicationDataDirectory, optionsFilePath) = GetOrCreateDataDirectory(applicationDataDirectoryBase, _session.CurrentProfileName); _optionsDataAccess = new OptionsDataAccess(optionsFilePath); _uiService = new UiService(); var options = _optionsDataAccess.Load(); _permanentStatusesViewModel = new PermanentStatusesViewModel(_uiService, this, options); _permanentStatusesViewModel.OptionsRequesting += PermanentStatusesViewModel_OptionsRequesting; _queryFolderStrategyWrapper = new OutlookFolderStrategyWrapper(QueryOutlookFolderByRequestingItemStrategy.Instance); _totalProgressFactory = new TotalProgressFactory( _uiService, generalOptions.ShowProgressBar, generalOptions.ThresholdForProgressDisplay, ExceptionHandler.Instance); _outlookSession = new OutlookSession(_session); _synchronizerFactory = new SynchronizerFactory( GetProfileDataDirectory, _totalProgressFactory, _outlookSession, _daslFilterProvider, _outlookAccountPasswordProvider, _globalTimeZoneCache, _queryFolderStrategyWrapper, exceptionHandlingStrategy, comWrapperFactory, _optionsDataAccess, _profileTypeRegistry); _synchronizationReportRepository = CreateSynchronizationReportRepository(); UpdateGeneralOptionDependencies(generalOptions); _scheduler = new Scheduler( _synchronizerFactory, this, EnsureSynchronizationContext, new FolderChangeWatcherFactory( _session), _synchronizationStatus); EnsureCacheCompatibility(options); _availableVersionService = new AvailableVersionService(); _updateChecker = new UpdateChecker(_availableVersionService, () => _generalOptionsDataAccess.IgnoreUpdatesTilVersion); _updateChecker.NewerVersionFound += UpdateChecker_NewerVersionFound; _updateChecker.IsEnabled = generalOptions.ShouldCheckForNewerVersions; _reportGarbageCollection = new ReportGarbageCollection(_synchronizationReportRepository, TimeSpan.FromDays(generalOptions.MaxReportAgeInDays)); _trayNotifier = generalOptions.EnableTrayIcon ? new TrayNotifier(this) : NullTrayNotifer.Instance; try { using (var syncObjects = GenericComObjectWrapper.Create(_session.SyncObjects)) { if (syncObjects.Inner != null && syncObjects.Inner.Count > 0) { _syncObject = syncObjects.Inner[1]; if (generalOptions.TriggerSyncAfterSendReceive) { _syncObject.SyncEnd += SyncObject_SyncEnd; } } } } catch (COMException ex) { s_logger.Error("Can't access SyncObjects", ex); } _oneTimeTaskRunner = new OneTimeTaskRunner(_outlookSession); DDayICalWorkaround.DDayICalCustomization.InitializeNoThrow(); }
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) { }
public override IProfileModelFactory CreateModelFactory(IOptionsViewModelParent optionsViewModelParent, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList <string> availableCategories, IOptionTasks optionTasks, GeneralOptions generalOptions, IViewOptions viewOptions, OptionModelSessionData sessionData) { return(new ProfileModelFactory(this, optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, generalOptions, viewOptions, sessionData)); }
public GenericProfile(IOptionsViewModelParent optionsViewModelParent, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList <string> availableCategories, IOptionTasks optionTasks, ISettingsFaultFinder settingsFaultFinder, GeneralOptions generalOptions, IViewOptions viewOptions) : base(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions) { }
public IProfileModelFactory CreateModelFactory(IOptionsViewModelParent optionsViewModelParent, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList <string> availableCategories, IOptionTasks optionTasks, ISettingsFaultFinder settingsFaultFinder, GeneralOptions generalOptions, IViewOptions viewOptions, OptionModelSessionData sessionData) { return(this); }
public ComponentContainer(Application application) { s_logger.Info("Startup..."); _generalOptionsDataAccess = new GeneralOptionsDataAccess(); _synchronizationStatus = new SynchronizationStatus(); var generalOptions = _generalOptionsDataAccess.LoadOptions(); _daslFilterProvider = new DaslFilterProvider(generalOptions.IncludeCustomMessageClasses); FrameworkElement.LanguageProperty.OverrideMetadata( typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); ConfigureServicePointManager(generalOptions); ConfigureLogLevel(generalOptions.EnableDebugLog); _session = application.Session; _outlookAccountPasswordProvider = string.IsNullOrEmpty(_session.CurrentProfileName) ? NullOutlookAccountPasswordProvider.Instance : new OutlookAccountPasswordProvider(_session.CurrentProfileName, application.Version); _globalTimeZoneCache = new GlobalTimeZoneCache(); EnsureSynchronizationContext(); _applicationDataDirectory = Path.Combine( Environment.GetFolderPath( generalOptions.StoreAppDataInRoamingFolder ? Environment.SpecialFolder.ApplicationData : Environment.SpecialFolder.LocalApplicationData), "CalDavSynchronizer"); _optionsDataAccess = new OptionsDataAccess( Path.Combine( _applicationDataDirectory, GetOrCreateConfigFileName(_applicationDataDirectory, _session.CurrentProfileName) )); _synchronizerFactory = new SynchronizerFactory( GetProfileDataDirectory, new TotalProgressFactory( new ProgressFormFactory(), int.Parse(ConfigurationManager.AppSettings["loadOperationThresholdForProgressDisplay"]), ExceptionHandler.Instance), _session, _daslFilterProvider, _outlookAccountPasswordProvider, _globalTimeZoneCache); _synchronizationReportRepository = CreateSynchronizationReportRepository(); UpdateGeneralOptionDependencies(generalOptions); _scheduler = new Scheduler( _synchronizerFactory, this, EnsureSynchronizationContext, new FolderChangeWatcherFactory( _session), _synchronizationStatus); var options = _optionsDataAccess.LoadOptions(); EnsureCacheCompatibility(options); _profileStatusesViewModel = new ProfileStatusesViewModel(this); _profileStatusesViewModel.EnsureProfilesDisplayed(options); _availableVersionService = new AvailableVersionService(); _updateChecker = new UpdateChecker(_availableVersionService, () => _generalOptionsDataAccess.IgnoreUpdatesTilVersion); _updateChecker.NewerVersionFound += UpdateChecker_NewerVersionFound; _updateChecker.IsEnabled = generalOptions.ShouldCheckForNewerVersions; _reportGarbageCollection = new ReportGarbageCollection(_synchronizationReportRepository, TimeSpan.FromDays(generalOptions.MaxReportAgeInDays)); _trayNotifier = generalOptions.EnableTrayIcon ? new TrayNotifier(this) : NullTrayNotifer.Instance; _uiService = new UiService(_profileStatusesViewModel); using (var syncObjects = GenericComObjectWrapper.Create(_session.SyncObjects)) { if (syncObjects.Inner != null && syncObjects.Inner.Count > 0) { _syncObject = syncObjects.Inner[1]; if (generalOptions.TriggerSyncAfterSendReceive) { _syncObject.SyncEnd += _sync_SyncEnd; } } } }
public ServerSettingsTemplateViewModel (IOutlookAccountPasswordProvider outlookAccountPasswordProvider) { _outlookAccountPasswordProvider = outlookAccountPasswordProvider; }