コード例 #1
0
        public ProjectPlus(IProjectOwner owner, string filename) {
            _owner = owner;
            FullPath = Path.Combine(_owner.Directory, filename);
            InitialTargets = new StringPropertyList(() => Xml.InitialTargets, v => Xml.InitialTargets = v, target => LookupTarget(target, null), true);

            FirstInitTarget = new Core.Utility.LazyEx<ProjectTargetElement>(() => {
                var tgt = LookupTarget("{0}_init_{1}_1".format(SafeName, Path.GetExtension(Filename).Trim('.')), null, true);
                InitialTargets.Add(tgt.Name);
                return tgt;
            });

            SecondInitTarget = new Core.Utility.LazyEx<ProjectTargetElement>(() => {
                // ensure the first one is created.
                var x = FirstInitTarget.Value;

                var tgt = LookupTarget("{0}_init_{1}_2".format(SafeName, Path.GetExtension(Filename).Trim('.')), null, true);
                InitialTargets.Add(tgt.Name);
                return tgt;
            });

            ItemGroupInitTarget = new Core.Utility.LazyEx<ProjectTargetElement>(() => {
                // ensure the first one is created.
                var x = SecondInitTarget.Value;

                var tgt = LookupTarget("{0}_ItemGroupInit_{1}_3".format(SafeName, Path.GetExtension(Filename).Trim('.')), null, true);
                InitialTargets.Add(tgt.Name);
                return tgt;
            });

            EarlyInitTarget = new Core.Utility.LazyEx<ProjectTargetElement>(() => {
                var tgt = LookupTarget("{0}_init_{1}_0".format(SafeName, Path.GetExtension(Filename).Trim('.')), null, true);
                InitialTargets.Insert(0,tgt.Name);
                return tgt;
            });
        }
コード例 #2
0
        public ProjectPlus(IProjectOwner owner, string filename)
        {
            _owner = owner;
            FullPath = Path.Combine(_owner.Directory, filename);

            InitialTargets = new StringPropertyList(() => Xml.InitialTargets, v => Xml.InitialTargets = v, target => LookupTarget(target, null),true);
        }
コード例 #3
0
        /// <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;
        }
コード例 #4
0
 /// <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;
 }
コード例 #5
0
 public void SetProjectOwner(IProjectOwner projectOwner)
 {
     //Add some validation for this. Like checking if the project owner is set.
     if (projectOwner == null)
     {
         throw new Exception("Project owner cannot be null.");
     }
     if (projectOwner is Member)
     {
         ProjectOwner = projectOwner;
         MemberId     = projectOwner.Id;
     }
     if (projectOwner is ExternalResourcePerson)
     {
         ExternalProjectOwner     = projectOwner;
         ExternalResourcePersonId = projectOwner.Id;
     }
 }
コード例 #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;
        }