public void CloseProject() { m_projectModel = null; MainForm mainForm = FindForm() as MainForm; if (mainForm != null) { mainForm.DeinitializeProjectPages(); mainForm.SelectTabPage(MainForm.TAB_NAME_PROJECT); mainForm.AppTitleExtended = null; } }
public void CreateNewProject(string path, string name) { path = Path.GetFullPath(path); string wrkdir = "resources"; Newtonsoft.Json.Linq.JObject args = new Newtonsoft.Json.Linq.JObject(); args["inputPath"] = wrkdir; args["outputPath"] = path; args["name"] = name; if (TemplateFilesManager.ProcessTemplates(MAKE_NEW_PROJECT_TEMPLATE_PATH, args) && Directory.Exists(path)) { ProjectModel projectModel = new ProjectModel(); projectModel.Setup(name, path); string json = JsonConvert.SerializeObject(projectModel, Formatting.Indented); File.WriteAllText(projectModel.ProjectFilePath, json); OpenProject(projectModel.ProjectFilePath); } }
public void OpenProject(string filePath) { filePath = Path.GetFullPath(filePath); if (!File.Exists(filePath)) return; CloseProject(); string json = File.ReadAllText(filePath); m_projectModel = JsonConvert.DeserializeObject<ProjectModel>(json); m_projectModel.WorkingDirectory = Path.GetDirectoryName(filePath); MainForm mainForm = FindForm() as MainForm; if (mainForm != null) { mainForm.InitializeProjectPages(); mainForm.AppTitleExtended = m_projectModel.Name; } }