Пример #1
0
        public void Open(string path)
        {
            ProjectEventArgs preOpenEventArgs = new ProjectEventArgs(path);

            _eventAggregator.GetEvent <ProjectPreOpenEvent>().Publish(preOpenEventArgs);
            _packageService.Open(path);
            string           strProject    = _packageService.Current.GetFileContent(Constant.PACKAGE_PROJECT_FILE_NAME);
            ProjectEntityDev projectEntity = new ProjectEntityDev();

            projectEntity.FromXml(strProject);
            string         strProjectSummary = _packageService.Current.GetFileContent(Constant.PACKAGE_SUMMARY_FILE_NAME);
            ProjectSummary projectSummary    = new ProjectSummary();

            projectSummary.FromXml(strProjectSummary);
            Project project = new Project(projectEntity, projectSummary);

            project.ProjectFile    = path;
            projectService.Current = project;
            ProjectAvailableEventArgs openedEventArgs = new ProjectAvailableEventArgs(project);

            _eventAggregator.GetEvent <ProjectOpenedEvent>().Publish(openedEventArgs);
            projectSummary.FirstRun = false;
            Save(projectSummary);
            return;
        }
Пример #2
0
        public void NewProject(string folder, string name)
        {
            string         path    = Path.Combine(folder, name + Constant.PROJECT_FILE_EXTENSION);
            IPackage       package = _packageService.Create(path);
            ProjectSummary summary = new ProjectSummary();

            summary.FirstRun = true;
            package.AddFileContent(summary.ToXml(), Constant.PACKAGE_SUMMARY_FILE_NAME);
            ProjectEntityDev projectEntity = new ProjectEntityDev();

            projectEntity.Name             = name;
            projectEntity.Code             = "NewProject";
            projectEntity.UserModel        = true;
            projectEntity.UserPopedomModel = true;
            projectEntity.UserSubsequent   = true;
            package.AddFileContent(projectEntity.ToXml(), Constant.PACKAGE_PROJECT_FILE_NAME);
            package.Close();
            ProjectEventArgs args = new ProjectEventArgs(path);

            _eventAggregator.GetEvent <ProjectCreatedEvent>().Publish(args);
        }