public Options[] ShowWpfOptions(Guid?initialSelectedProfileId, GeneralOptions generalOptions, Options[] options) { string[] categories; using (var categoriesWrapper = GenericComObjectWrapper.Create(_session.Categories)) { categories = categoriesWrapper.Inner.ToSafeEnumerable <Category>().Select(c => c.Name).ToArray(); } var viewModel = new OptionsCollectionViewModel( _session, generalOptions, _outlookAccountPasswordProvider, categories, GetProfileDataDirectory); _currentVisibleOptionsFormOrNull = viewModel; viewModel.SetOptionsCollection(options, initialSelectedProfileId); if (_uiService.ShowOptions(viewModel)) { _optionsDataAccess.EnsureBackupExists("Wpf"); return(viewModel.GetOptionsCollection()); } else { return(null); } }
public Options[] ShowWpfOptions(Guid?initialSelectedProfileId, GeneralOptions generalOptions, Options[] options) { string[] categories; using (var categoriesWrapper = GenericComObjectWrapper.Create(_session.Categories)) { categories = categoriesWrapper.Inner.ToSafeEnumerable <Category>().Select(c => c.Name).ToArray(); } var faultFinder = generalOptions.FixInvalidSettings ? new SettingsFaultFinder(EnumDisplayNameProvider.Instance) : NullSettingsFaultFinder.Instance; var optionTasks = new OptionTasks(_session, EnumDisplayNameProvider.Instance, faultFinder); var viewOptions = new ViewOptions(generalOptions.EnableAdvancedView); var viewModel = new OptionsCollectionViewModel( generalOptions.ExpandAllSyncProfiles, GetProfileDataDirectory, _uiService, optionTasks, p => ProfileTypeRegistry.Create(p, _outlookAccountPasswordProvider, categories, optionTasks, faultFinder, generalOptions, viewOptions), viewOptions); _currentVisibleOptionsFormOrNull = viewModel; viewModel.SetOptionsCollection(options, initialSelectedProfileId); if (_uiService.ShowOptions(viewModel)) { _optionsDataAccess.EnsureBackupExists("SimplifiedUi"); return(viewModel.GetOptionsCollection()); } else { return(null); } }