/// <summary> /// Initializes a new instance of the <see cref="GuiCore"/> class. /// </summary> /// <param name="mainWindow">The main window.</param> /// <param name="projectStore">The project store.</param> /// <param name="projectMigrator">The project migrator.</param> /// <param name="projectFactory">The project factory.</param> /// <param name="fixedSettings">The fixed settings.</param> /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception> public GuiCore(IMainWindow mainWindow, IStoreProject projectStore, IMigrateProject projectMigrator, IProjectFactory projectFactory, GuiCoreSettings fixedSettings) { if (mainWindow == null) { throw new ArgumentNullException(nameof(mainWindow)); } if (projectStore == null) { throw new ArgumentNullException(nameof(projectStore)); } if (projectMigrator == null) { throw new ArgumentNullException(nameof(projectMigrator)); } if (projectFactory == null) { throw new ArgumentNullException(nameof(projectFactory)); } if (fixedSettings == null) { throw new ArgumentNullException(nameof(fixedSettings)); } ProjectStore = projectStore; FixedSettings = fixedSettings; MainWindow = mainWindow; Plugins = new List <PluginBase>(); viewCommandHandler = new ViewCommandHandler(this, this, this); StorageCommands = new StorageCommandHandler(projectStore, projectMigrator, projectFactory, this, dialogBasedInquiryHelper, this); importCommandHandler = new GuiImportHandler(MainWindow, Plugins.SelectMany(p => p.GetImportInfos()) .Concat(MapImportInfoFactory.Create()), dialogBasedInquiryHelper); exportCommandHandler = new GuiExportHandler(MainWindow, Plugins.SelectMany(p => p.GetExportInfos())); updateCommandHandler = new GuiUpdateHandler(MainWindow, Plugins.SelectMany(p => p.GetUpdateInfos()), dialogBasedInquiryHelper); WindowsApplication.EnableVisualStyles(); ViewPropertyEditor.ViewCommands = ViewCommands; ProjectOpened += ApplicationProjectOpened; BeforeProjectOpened += ApplicationBeforeProjectOpened; projectObserver = new Observer(UpdateProjectData); applicationTitle = string.Format(CultureInfo.CurrentCulture, "{0} {1}", FixedSettings.ApplicationName, SettingsHelper.Instance.ApplicationVersion); SetTitle(); }
/// <summary> /// Creates a new instance of <see cref="StorageCommandHandler"/>. /// </summary> /// <param name="projectStorage">Class responsible to storing and loading the application project.</param> /// <param name="projectMigrator">Class responsible for the migration of the application projects.</param> /// <param name="projectFactory">The factory to use when creating new projects.</param> /// <param name="projectOwner">The class owning the application project.</param> /// <param name="inquiryHelper">The object facilitating user interaction.</param> /// <param name="mainWindowController">The object owning the parent controller for UI.</param> public StorageCommandHandler(IStoreProject projectStorage, IMigrateProject projectMigrator, IProjectFactory projectFactory, IProjectOwner projectOwner, IInquiryHelper inquiryHelper, IMainWindowController mainWindowController) { projectPersister = projectStorage; this.projectMigrator = projectMigrator; this.projectFactory = projectFactory; this.projectOwner = projectOwner; this.inquiryHelper = inquiryHelper; this.mainWindowController = mainWindowController; }
/// <summary> /// Creates a new instance of <see cref="OpenProjectActivity"/>. /// </summary> /// <param name="requiredOpenProjectProperties">All mandatory properties for being /// able to open a project.</param> /// <param name="optionalProjectMigrationProperties">Optional: Properties for migrating /// the project to the current version.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="requiredOpenProjectProperties"/> /// is <c>null</c>.</exception> /// <exception cref="ArgumentException">Thrown when any input argument has invalid values.</exception> public OpenProjectActivity(OpenProjectConstructionProperties requiredOpenProjectProperties, ProjectMigrationConstructionProperties optionalProjectMigrationProperties = null) { if (requiredOpenProjectProperties == null) { throw new ArgumentNullException(nameof(requiredOpenProjectProperties)); } ValidateOpenProjectProperties(requiredOpenProjectProperties); if (optionalProjectMigrationProperties != null) { ValidateProjectMigrationProperties(optionalProjectMigrationProperties); migratedProjectFilePath = optionalProjectMigrationProperties.MigrationFilePath; migrator = optionalProjectMigrationProperties.Migrator; totalNumberOfSteps = 3; } filePath = requiredOpenProjectProperties.FilePath; projectOwner = requiredOpenProjectProperties.ProjectOwner; storage = requiredOpenProjectProperties.ProjectStorage; Description = Resources.OpenProjectActivity_Open_project; }