public int PromptOpenProjectFile() { OpenFileDialog OpenProjectDialog = new OpenFileDialog(); OpenProjectDialog.Title = "Select a Project File to Open (*.imsprj)"; OpenProjectDialog.Filter = @"project files|*.imsPrj;"; OpenProjectDialog.CheckPathExists = true; OpenProjectDialog.CheckFileExists = true; if (pcExecutionSystemMetaData.SysModuleProjectPathStrings != null) { if (pcExecutionSystemMetaData.SysModuleProjectPathStrings.Count > 0) { OpenProjectDialog.InitialDirectory = Path.GetDirectoryName(pcExecutionSystemMetaData.SysModuleProjectPathStrings[0]); } } DialogResult theseResults = OpenProjectDialog.ShowDialog(); if (theseResults == DialogResult.OK) { ProjectPathRequestedforOpen = OpenProjectDialog.FileName; CloseProject(); } ExtAppBGWorkerLink.RunWorkerAsync(); return(0); }
public int PromptSaveProject2File() { SaveFileDialog SaveProjectDialog = new SaveFileDialog(); SaveProjectDialog.Title = "Save Project File as (*.imsprj)"; SaveProjectDialog.Filter = @"project files|*.imsPrj;"; //SaveProjectDialog.CheckPathExists = true; //SaveProjectDialog.CheckFileExists = true; if (pcExecutionSystemMetaData.SysModuleProjectPathStrings != null) { if (pcExecutionSystemMetaData.SysModuleProjectPathStrings.Count > 0) { SaveProjectDialog.InitialDirectory = Path.GetDirectoryName(pcExecutionSystemMetaData.SysModuleProjectPathStrings[0]); } } DialogResult theseResults = SaveProjectDialog.ShowDialog(); if (theseResults == DialogResult.OK) { if (!File.Exists(SaveProjectDialog.FileName) && SaveProjectDialog.FileName != "") { FileStream tfs = File.Create(SaveProjectDialog.FileName); if (tfs != null) { ProjectPathRequestedforSave = SaveProjectDialog.FileName; tfs.Close(); } } else if (File.Exists(SaveProjectDialog.FileName)) { ProjectPathRequestedforSave = SaveProjectDialog.FileName; } ExtAppBGWorkerLink.RunWorkerAsync(); } return(0); }