public static string GetLibraryPath(IWin32Window parent, string fileName) { using (var dlg = new OpenFileDialog { InitialDirectory = Settings.Default.LibraryDirectory, CheckPathExists = true, SupportMultiDottedExtensions = true, DefaultExt = BiblioSpecLibSpec.EXT, Filter = TextUtil.FileDialogFiltersAll(TextUtil.FileDialogFilter(Resources.EditLibraryDlg_GetLibraryPath_Spectral_Libraries, BiblioSpecLiteSpec.EXT, ChromatogramLibrarySpec.EXT, XHunterLibSpec.EXT, NistLibSpec.EXT, SpectrastSpec.EXT, MidasLibSpec.EXT, EncyclopeDiaSpec.EXT), TextUtil.FileDialogFilter(Resources.EditLibraryDlg_GetLibraryPath_Legacy_Libraries, BiblioSpecLibSpec.EXT)) }) { if (fileName != null) { dlg.FileName = fileName; } if (dlg.ShowDialog(parent) != DialogResult.OK) { return(null); } Settings.Default.LibraryDirectory = Path.GetDirectoryName(dlg.FileName); return(dlg.FileName); } }
public static void InstallZipFromFile(Control parent, InstallProgram install) { using (var dlg = new OpenFileDialog { Filter = TextUtil.FileDialogFiltersAll(TextUtil.FileDialogFilter( Resources.ConfigureToolsDlg_AddFromFile_Zip_Files, ToolDescription.EXT_INSTALL)), Multiselect = false }) { if (dlg.ShowDialog(parent) == DialogResult.OK) { InstallZipTool(parent, dlg.FileName, install); } } }
private void ImportTextFile() { using (var dlg = new OpenFileDialog { Title = Resources.ChooseIrtStandardPeptides_ImportTextFile_Import_Transition_List__iRT_standards_, InitialDirectory = Path.GetDirectoryName(_documentFilePath), DefaultExt = TextUtil.EXT_CSV, Filter = TextUtil.FileDialogFiltersAll(TextUtil.FileDialogFilter(Resources.ChooseIrtStandardPeptides_ImportTextFile_Transition_List, TextUtil.EXT_CSV, TextUtil.EXT_TSV)) }) { if (dlg.ShowDialog(this) == DialogResult.OK) { Settings.Default.ActiveDirectory = Path.GetDirectoryName(dlg.FileName); SetTransitionListFile(dlg.FileName); } } }
public void Browse() { using (OpenFileDialog dlg = new OpenFileDialog { Title = Resources.CreateIrtCalculatorDlg_ImportTextFile_Import_Transition_List__iRT_standards_, InitialDirectory = Settings.Default.ActiveDirectory, DefaultExt = TextUtil.EXT_CSV, Filter = TextUtil.FileDialogFiltersAll(TextUtil.FileDialogFilter( Resources.SkylineWindow_importMassListMenuItem_Click_Transition_List, TextUtil.EXT_CSV, TextUtil.EXT_TSV)) }) { if (dlg.ShowDialog(this) == DialogResult.OK) { Settings.Default.ActiveDirectory = Path.GetDirectoryName(dlg.FileName); textFilePath.Text = dlg.FileName; textFilePath.Focus(); } } }
private void btnBrowseFile_Click(object sender, EventArgs e) { using (var dlg = new OpenFileDialog { InitialDirectory = Settings.Default.LibraryDirectory, CheckPathExists = true, DefaultExt = BiblioSpecLiteSpec.EXT, Filter = TextUtil.FileDialogFiltersAll( TextUtil.FileDialogFilter(Resources.AddIrtSpectralLibrary_btnBrowseFile_Click_Spectral_Libraries, BiblioSpecLiteSpec.EXT, ChromatogramLibrarySpec.EXT) ) }) { if (dlg.ShowDialog(this) != DialogResult.OK) { return; } Settings.Default.LibraryDirectory = Path.GetDirectoryName(dlg.FileName); textFilePath.Text = dlg.FileName; } }
public void CommandBtnClick() { int i = 0; using (var dlg = new OpenFileDialog { Filter = TextUtil.FileDialogFiltersAll( TextUtil.FileDialogFilter(Resources.ConfigureToolsDlg_btnFindCommand_Click_All_Executables, EXTENSIONS[i++]), TextUtil.FileDialogFilter(Resources.ConfigureToolsDlg_btnFindCommand_Click_Command_Files, EXTENSIONS[i++]), TextUtil.FileDialogFilter(Resources.ConfigureToolsDlg_btnFindCommand_Click_Information_Files, EXTENSIONS[i++]), TextUtil.FileDialogFilter(Resources.ConfigureToolsDlg_btnFindCommand_Click_Batch_Files, EXTENSIONS[i++], EXTENSIONS[i++]), TextUtil.FileDialogFilter(Resources.ConfigureToolsDlg_btnFindCommand_Click_Python_Scripts, EXTENSIONS[i++]), TextUtil.FileDialogFilter(Resources.ConfigureToolsDlg_btnFindCommand_Click_Perl_Scripts, EXTENSIONS[i]) ), FilterIndex = 1, Multiselect = false }) { if (dlg.ShowDialog(this) == DialogResult.OK) { textCommand.Text = dlg.FileName; } } }