/// <summary> /// Function to create the main view model and any child view models. /// </summary> /// <param name="gpuName">The name of the GPU used by the application.</param> /// <returns>A new instance of the main view model.</returns> /// <exception cref="ArgumentNullException">Thrown when the <paramref name="workspace"/> parameter is <b>null</b>.</exception> public IMain CreateMainViewModel(string gpuName) { ISettingsPlugInsList pluginList = GetPlugInListViewModel(); var settingsVm = new EditorSettingsVm(); IEnumerable <ISettingsCategoryViewModel> categories = GetPlugInSettingsCategories(); settingsVm.Initialize(new EditorSettingsParameters(new[] { pluginList }.Concat(categories), pluginList, MessageDisplay, BusyService)); var newProjectVm = new StageNewVm { GPUName = gpuName }; var recentFilesVm = new RecentVm(); var mainVm = new Main(); newProjectVm.Initialize(new StageNewVmParameters(this)); recentFilesVm.Initialize(new RecentVmParameters(this)); mainVm.Initialize(new MainParameters(newProjectVm, recentFilesVm, settingsVm, EnumerateContentCreators(), this, new EditorFileOpenDialogService(Settings, FileSystemProviders), new EditorFileSaveDialogService(Settings, FileSystemProviders))); return(mainVm); }
/// <summary>Initializes a new instance of the <see cref="EditorSettingsParameters"/> class.</summary> /// <param name="factory">The view model factory.</param> /// <param name="categories">The list of settings categories.</param> /// <param name="pluginsList">The list of plug ins for the fixed plugin list category.</param> /// <param name="messageDisplay">The message display service.</param> /// <param name="busyService">The busy state service.</param> /// <exception cref="ArgumentNullException">Thrown when any parameter is <b>null</b>.</exception> public EditorSettingsParameters(IEnumerable <ISettingsCategoryViewModel> categories, ISettingsPlugInsList pluginsList, IMessageDisplayService messageDisplay, IBusyStateService busyService) { MessageDisplay = messageDisplay ?? throw new ArgumentNullException(nameof(messageDisplay)); Categories = categories ?? throw new ArgumentNullException(nameof(categories)); PlugInsList = pluginsList ?? throw new ArgumentNullException(nameof(pluginsList)); BusyService = busyService ?? throw new ArgumentNullException(nameof(busyService)); }