Наследование: ViewModelBase, IOptionsSection
Пример #1
0
        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 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();
    }
Пример #3
0
 /// <remarks>
 /// Just for creating the DesingInstance
 /// </remarks>
 public GenericOptionsViewModel(IOptionsViewModelParent parent, NetworkSettingsViewModel networkSettingsViewModel, OutlookFolderViewModel outlookFolderViewModel, IServerSettingsViewModel serverSettingsViewModel, SyncSettingsViewModel syncSettingsViewModel, IOptionsViewModel mappingConfigurationViewModel)
     : base(parent)
 {
     _networkSettingsViewModel     = networkSettingsViewModel;
     _outlookFolderViewModel       = outlookFolderViewModel;
     _serverSettingsViewModel      = serverSettingsViewModel;
     _syncSettingsViewModel        = syncSettingsViewModel;
     MappingConfigurationViewModel = mappingConfigurationViewModel;
 }
 /// <remarks>
 /// Just for creating the DesingInstance
 /// </remarks>
 public GenericOptionsViewModel (IOptionsViewModelParent parent, NetworkSettingsViewModel networkSettingsViewModel, OutlookFolderViewModel outlookFolderViewModel, IServerSettingsViewModel serverSettingsViewModel, SyncSettingsViewModel syncSettingsViewModel, ISubOptionsViewModel mappingConfigurationViewModel)
     : base (parent)
 {
   _networkSettingsViewModel = networkSettingsViewModel;
   _outlookFolderViewModel = outlookFolderViewModel;
   _serverSettingsViewModel = serverSettingsViewModel;
   _syncSettingsViewModel = syncSettingsViewModel;
   MappingConfigurationViewModel = mappingConfigurationViewModel;
 }
Пример #5
0
        public GenericOptionsViewModel(
            IOptionsViewModelParent parent,
            IOptionsSection serverSettingsViewModel,
            IOptionTasks optionTasks,
            OptionsModel model,
            IReadOnlyList <string> availableCategories,
            IViewOptions viewOptions)
            : base(viewOptions, model)
        {
            if (parent == null)
            {
                throw new ArgumentNullException(nameof(parent));
            }
            if (serverSettingsViewModel == null)
            {
                throw new ArgumentNullException(nameof(serverSettingsViewModel));
            }
            if (optionTasks == null)
            {
                throw new ArgumentNullException(nameof(optionTasks));
            }
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }
            if (availableCategories == null)
            {
                throw new ArgumentNullException(nameof(availableCategories));
            }


            Model = model;
            _availableCategories = availableCategories;

            _syncSettingsViewModel    = new SyncSettingsViewModel(model, viewOptions);
            _networkSettingsViewModel = new NetworkSettingsViewModel(model);

            _serverSettingsViewModel = serverSettingsViewModel;
            _outlookFolderViewModel  = new OutlookFolderViewModel(model, optionTasks, viewOptions);
            _timeRangeViewModel      = new TimeRangeViewModel(model, viewOptions);

            RegisterPropertyChangeHandler(model, nameof(model.MappingConfigurationModelOrNull), UpdateMappingConfigurationViewModel);

            RegisterPropertyChangePropagation(model, nameof(model.SelectedFolderOrNull), nameof(OutlookFolderType));
        }