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 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 ( 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); }