//--------------------------------------------------------------------// // M e t h o d // // c r e a t e O p e n F i l e D i a l o g // //--------------------------------------------------------------------// // // // Creates a OpenFileDialog. // // // //--------------------------------------------------------------------// public static OpenFileDialog createOpenFileDialog(String initialPath) { String folderName = null; String fileName = null; ToolCommonFunctions.splitPathName(initialPath, ref folderName, ref fileName); OpenFileDialog openDialog = new OpenFileDialog(); openDialog.InitialDirectory = Directory.Exists(folderName) ? folderName : Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); openDialog.FileName = fileName; openDialog.CheckFileExists = true; openDialog.Filter = "All files|*.*"; return(openDialog); }
//--------------------------------------------------------------------// // M e t h o d // // c r e a t e S a v e F i l e D i a l o g // //--------------------------------------------------------------------// // // // Creates a SaveFileDialog. // // // //--------------------------------------------------------------------// public static SaveFileDialog createSaveFileDialog(String initialPath) { String folderName = null; String fileName = null; ToolCommonFunctions.splitPathName(initialPath, ref folderName, ref fileName); SaveFileDialog saveDialog = new SaveFileDialog(); saveDialog.InitialDirectory = Directory.Exists(folderName) ? folderName : Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); saveDialog.FileName = fileName; saveDialog.Filter = "Print Files | *.prn; *.PRN"; saveDialog.DefaultExt = "prn"; saveDialog.RestoreDirectory = true; saveDialog.OverwritePrompt = true; saveDialog.CheckFileExists = false; saveDialog.CheckPathExists = true; return(saveDialog); }