/// <summary>
        /// Creates a new instance of <see cref="SaveProjectActivity"/>.
        /// </summary>
        /// <param name="project">The project to be saved.</param>
        /// <param name="filePath">The location to save the project to.</param>
        /// <param name="savingExistingProject">When <c>true</c> it indicates that <paramref name="project"/>
        /// is already located at <paramref name="filePath"/>. When <c>false</c> then <paramref name="project"/>
        /// is not already located at <paramref name="filePath"/>.</param>
        /// <param name="storeProject">The object responsible for saving <paramref name="project"/>.</param>
        /// <param name="projectOwner">The object responsible for hosting <paramref name="project"/>.</param>
        /// <exception cref="ArgumentNullException">Thrown when any input argument is <c>null</c>.</exception>
        public SaveProjectActivity(IProject project, string filePath, bool savingExistingProject, IStoreProject storeProject, IProjectOwner projectOwner)
        {
            if (project == null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            if (filePath == null)
            {
                throw new ArgumentNullException(nameof(filePath));
            }

            if (storeProject == null)
            {
                throw new ArgumentNullException(nameof(storeProject));
            }

            if (projectOwner == null)
            {
                throw new ArgumentNullException(nameof(projectOwner));
            }

            this.savingExistingProject = savingExistingProject;
            this.project      = project;
            this.filePath     = filePath;
            this.storeProject = storeProject;
            this.projectOwner = projectOwner;

            Description = savingExistingProject
                              ? Resources.SaveProjectActivity_Save_existing_project
                              : Resources.SaveProjectActivity_Save_project;
        }
Exemple #2
0
        /// <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="LoadAssessmentSectionService"/>.
        /// </summary>
        /// <param name="projectStorage">Class responsible for loading the project.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="projectStorage"/> is <c>null</c>.</exception>
        public LoadAssessmentSectionService(IStoreProject projectStorage)
        {
            if (projectStorage == null)
            {
                throw new ArgumentNullException(nameof(projectStorage));
            }

            storage = projectStorage;
        }
 /// <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;
 }
Exemple #5
0
        /// <summary>
        /// Initializes a new instance of <see cref="AssessmentSectionProvider"/>.
        /// </summary>
        /// <param name="viewParent">The parent of the view.</param>
        /// /// <param name="projectStorage">Class responsible for loading the project.</param>
        /// <exception cref="ArgumentNullException">Thrown when any parameter
        /// is <c>null</c>.</exception>
        public AssessmentSectionProvider(IViewParent viewParent, IStoreProject projectStorage)
        {
            if (viewParent == null)
            {
                throw new ArgumentNullException(nameof(viewParent));
            }

            if (projectStorage == null)
            {
                throw new ArgumentNullException(nameof(projectStorage));
            }

            this.viewParent     = viewParent;
            this.projectStorage = projectStorage;
        }
Exemple #6
0
        /// <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;
        }
 public ProjectController(IStoreProject mainStore)
 {
     _mainStore = mainStore;
 }