//builds a new project folder heirarchy public static void BuildNewProjectFolder(string username, ProjectInfo projectInfo) { //We locate the user folder that we are working with string path = "C:\\SynType\\Data\\"+username; DirectoryInfo baseDInfo = new DirectoryInfo(path); if (!baseDInfo.Exists) Console.WriteLine("FFManager.BuildNewProjectFolder: Could not find the username folder given"); //first we create the new project folder Directory.CreateDirectory(baseDInfo.FullName + "\\" + projectInfo.ProjectName); using (Stream s = File.Create(baseDInfo.FullName + "\\" + projectInfo.ProjectName+".spf")) { BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(s, projectInfo); } }
private void OpenProject(User user, ProjectInfo projectInfo) { this.user = user; this.Text = "SynType " + this.user.UserInitials + " loaded project: " + projectInfo.ProjectName; currentProject = new Project(projectInfo.ProjectName, projectInfo.ProjectPath, user); if (currentProject.AllSyntheses.Count == 0) { //IF there are no syntheses then we prompt the user to create a new one if (MessageBox.Show("The project is empty, would you like to create a new synthesis now?", "Create a new synthesis?", MessageBoxButtons.YesNo) == DialogResult.Yes) { InputDialog inputDialog = new InputDialog("Enter a name for the new synthesis"); if (inputDialog.ShowDialog() == DialogResult.OK) { while(string.IsNullOrEmpty(inputDialog.Input)) { if (inputDialog.ShowDialog() == DialogResult.Cancel) return; } Synthesis newSynth = new Synthesis(inputDialog.Input, currentProject.GetNewProjectID()); currentSynthesis = newSynth; currentProject.AllSyntheses.Add(currentSynthesis); //Save the synthesis FFManager.SaveSynFile(currentSynthesis, currentProject); } } } UpdateTreeView(); }
public StartupInfo(User lastUser, ProjectInfo lastProject) { LastUser = lastUser; LastProject = lastProject; }
//FILE toolstrip click events private void newProjectToolStripMenuItem_Click(object sender, EventArgs e) { InputDialog inputDialog = new InputDialog("Please enter the name of the project you wish to create."); if (inputDialog.ShowDialog() == DialogResult.OK) { string projectName = inputDialog.Input; if (!string.IsNullOrEmpty(projectName)) { ProjectInfo projectInfo = new ProjectInfo(projectName, "C:\\SynType\\Data\\rap\\"+ projectName, username); FFManager.BuildNewProjectFolder("rap", projectInfo); } } }