private LEDDialogResult GetFileInfoFromDialog(bool useSaveFileDialog) { //FileDialog fileDialog = useSaveFileDialog ? new SaveFileDialog() : new OpenFileDialog(); FileDialog fileDialog = useSaveFileDialog ? (FileDialog) new SaveFileDialog() : (FileDialog) new OpenFileDialog(); //OpenFileDialog openFileDialog = new OpenFileDialog(); fileDialog.Filter = "All files (*.*)|*.*"; fileDialog.FilterIndex = 0; fileDialog.RestoreDirectory = true; DialogResult dialogResult; dialogResult = fileDialog.ShowDialog(); LEDDialogResult LDResult = new LEDDialogResult(); if (dialogResult == DialogResult.OK) { LDResult.FileName = fileDialog.FileName; } LDResult.DialogResult = dialogResult; return(LDResult); }
private LEDDialogResult GetFileInfoFromDialog(bool useSaveFileDialog) { //FileDialog fileDialog = useSaveFileDialog ? new SaveFileDialog() : new OpenFileDialog(); FileDialog fileDialog = useSaveFileDialog ? (FileDialog)new SaveFileDialog() : (FileDialog)new OpenFileDialog(); //OpenFileDialog openFileDialog = new OpenFileDialog(); fileDialog.Filter = "All files (*.*)|*.*"; fileDialog.FilterIndex = 0; fileDialog.RestoreDirectory = true; DialogResult dialogResult; dialogResult = fileDialog.ShowDialog(); LEDDialogResult LDResult = new LEDDialogResult(); if (dialogResult == DialogResult.OK) { LDResult.FileName = fileDialog.FileName; } LDResult.DialogResult = dialogResult; return LDResult; }
void Btn_OutputFileClick(object sender, EventArgs e) { LEDDialogResult result = GetFileInfoFromDialog(true); txt_OutputFile.Text = result.FileName; }