private void browseToResultsFileButton_Click(object sender, EventArgs e) { MsDataFileUri[] dataSources; using (var dlg = new OpenDataSourceDialog(Settings.Default.RemoteAccountList) { Text = Resources.ImportResultsControl_browseToResultsFileButton_Click_Import_Peptide_Search, InitialDirectory = new MsDataFilePath(DocumentDirectory) }) { // Use saved source type, if there is one. string sourceType = Settings.Default.SrmResultsSourceType; if (!string.IsNullOrEmpty(sourceType)) { dlg.SourceTypeName = sourceType; } if (dlg.ShowDialog(this) != DialogResult.OK) { return; } dataSources = dlg.DataSources; } if (dataSources == null || dataSources.Length == 0) { MessageDlg.Show(this, Resources.ImportResultsDlg_GetDataSourcePathsFile_No_results_files_chosen); return; } Array.ForEach(dataSources, d => ImportPeptideSearch.TryMatch(d.ToString(), true)); UpdateResultsFilesUI(); }
private void OpenFile(OpenDataSourceDialog openDataSourceDialog, string name) { WaitForConditionUI(() => openDataSourceDialog.ListItemNames.Contains(name)); RunUI(() => { openDataSourceDialog.SelectFile(name); openDataSourceDialog.Open(); }); }
public void Browse(string path = null) { using (var dlgOpen = new OpenDataSourceDialog(Settings.Default.RemoteAccountList) { Text = Resources.ImportResultsDIAControl_btnBrowse_Click_Browse_for_Results_Files }) { // The dialog expects null to mean no directory was supplied, so don't assign an empty string. string initialDir = path ?? Path.GetDirectoryName(DocumentContainer.DocumentFilePath); dlgOpen.InitialDirectory = new MsDataFilePath(initialDir); // Use saved source type, if there is one. string sourceType = Settings.Default.SrmResultsSourceType; if (!string.IsNullOrEmpty(sourceType)) { dlgOpen.SourceTypeName = sourceType; } if (dlgOpen.ShowDialog(this) != DialogResult.OK) { return; } var dataSources = dlgOpen.DataSources; if (dataSources == null || !dataSources.Any()) { MessageDlg.Show(this, Resources.ImportResultsDlg_GetDataSourcePathsFile_No_results_files_chosen); return; } foreach (var dataSource in dataSources.Where( d => !_foundResultsFiles.Select(f => f.Path).Contains(d.ToString()))) { _foundResultsFiles.Add(new ImportPeptideSearch.FoundResultsFile(dataSource.GetFileNameWithoutExtension(), dataSource.ToString())); } if (ResultsFilesChanged != null) { ResultsFilesChanged(this, new ImportResultsControl.ResultsFilesEventArgs(_foundResultsFiles.Count)); } } }
private void browseToResultsFileButton_Click(object sender, EventArgs e) { MsDataFileUri[] dataSources; using (var dlg = new OpenDataSourceDialog(Settings.Default.ChorusAccountList) { Text = Resources.ImportResultsControl_browseToResultsFileButton_Click_Import_Peptide_Search, InitialDirectory = new MsDataFilePath(DocumentDirectory) }) { // Use saved source type, if there is one. string sourceType = Settings.Default.SrmResultsSourceType; if (!string.IsNullOrEmpty(sourceType)) dlg.SourceTypeName = sourceType; if (dlg.ShowDialog(this) != DialogResult.OK) return; dataSources = dlg.DataSources; } if (dataSources == null || dataSources.Length == 0) { MessageDlg.Show(this, Resources.ImportResultsDlg_GetDataSourcePathsFile_No_results_files_chosen); return; } Array.ForEach(dataSources, d => ImportPeptideSearch.TryMatch(d.ToString(), true)); UpdateResultsFilesUI(); }
private void btnBrowse_Click(object sender, EventArgs e) { using (var dlgOpen = new OpenDataSourceDialog(Settings.Default.ChorusAccountList) { Text = Resources.ImportResultsDIAControl_btnBrowse_Click_Browse_for_Results_Files }) { // The dialog expects null to mean no directory was supplied, so don't assign an empty string. string initialDir = Path.GetDirectoryName(SkylineWindow.DocumentFilePath); dlgOpen.InitialDirectory = new MsDataFilePath(initialDir); // Use saved source type, if there is one. string sourceType = Settings.Default.SrmResultsSourceType; if (!string.IsNullOrEmpty(sourceType)) dlgOpen.SourceTypeName = sourceType; if (dlgOpen.ShowDialog(this) != DialogResult.OK) return; var dataSources = dlgOpen.DataSources; if (dataSources == null || !dataSources.Any()) { MessageDlg.Show(this, Resources.ImportResultsDlg_GetDataSourcePathsFile_No_results_files_chosen); return; } foreach (var dataSource in dataSources.Where(d => !_foundResultsFiles.Select(f => f.Path).Contains(d.ToString()))) { _foundResultsFiles.Add(new ImportPeptideSearch.FoundResultsFile(dataSource.GetFileNameWithoutExtension(), dataSource.ToString())); } if (ResultsFilesChanged != null) { ResultsFilesChanged(this, new ImportResultsControl.ResultsFilesEventArgs(_foundResultsFiles.Count)); } } }