/// ------------------------------------------------------------------------------------ /// <summary> /// Browse for an existing project. /// </summary> /// ------------------------------------------------------------------------------------ private void tsbBrowse_Click(object sender, EventArgs e) { using (var dlg = new OpenFileDialog()) { var caption = LocalizationManager.LocalizeString( "WelcomeDlg.OpenFileDlgCaption", "Open Sponge Project", "Dialog Boxes"); var prjFilterText = LocalizationManager.LocalizeString( "WelcomeDlg.SpongePrjFileType", "Sponge Project (*.sprj)", "Dialog Boxes"); dlg.Title = caption; dlg.Filter = prjFilterText + "|*.sprj|" + Sponge.OFDlgAllFileTypeText + "|*.*"; dlg.InitialDirectory = SpongeProject.ProjectsFolder; dlg.CheckFileExists = true; dlg.CheckPathExists = true; if (dlg.ShowDialog(this) == DialogResult.Cancel) { return; } Project = SpongeProject.Load(dlg.FileName); if (Project != null) { MruProjects.AddNewPath(dlg.FileName); MruProjects.Save(); } } DialogResult = DialogResult.OK; Close(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Create a new project. /// </summary> /// ------------------------------------------------------------------------------------ private void tsbCreate_Click(object sender, EventArgs e) { Project = SpongeProject.Create(this); if (Project != null) { MruProjects.AddNewPath(Project.FullFilePath); MruProjects.Save(); DialogResult = DialogResult.OK; Close(); } }