Esempio n. 1
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            if (DatabaseChanged)
            {
                var result = MessageBox.Show(this, Resources.EditOptimizationLibraryDlg_btnCreate_Click_Are_you_sure_you_want_to_create_a_new_optimization_library_file__Any_changes_to_the_current_library_will_be_lost_,
                                             Program.Name, MessageBoxButtons.YesNo);

                if (result != DialogResult.Yes)
                {
                    return;
                }
            }

            using (var dlg = new SaveFileDialog
            {
                Title = Resources.EditOptimizationLibraryDlg_btnCreate_Click_Create_Optimization_Library,
                InitialDirectory = Settings.Default.ActiveDirectory,
                OverwritePrompt = true,
                DefaultExt = OptimizationDb.EXT,
                Filter = TextUtil.FileDialogFiltersAll(OptimizationDb.FILTER_OPTDB)
            })
            {
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    Settings.Default.ActiveDirectory = Path.GetDirectoryName(dlg.FileName);

                    CreateDatabase(dlg.FileName);
                    textDatabase.Focus();
                    SetOptimizations(new DbOptimization[0]);
                    _original = null;
                }
            }
        }
Esempio n. 2
0
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            string fileName;

            try
            {
                fileName = Path.GetFileName(textPath.Text);
            }
            catch (Exception)
            {
                fileName = string.Empty;
            }

            using (var dlg = new SaveFileDialog
            {
                InitialDirectory = Settings.Default.LibraryDirectory,
                FileName = fileName,
                OverwritePrompt = true,
                DefaultExt = BiblioSpecLiteSpec.EXT,
                Filter = TextUtil.FileDialogFiltersAll(BiblioSpecLiteSpec.FILTER_BLIB)
            })
            {
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    Settings.Default.LibraryDirectory = Path.GetDirectoryName(dlg.FileName);

                    textPath.Text = dlg.FileName;
                }
            }
        }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            string filterProtDb = TextUtil.FileDialogFiltersAll(FILTER_PROTDB);

            string fileName;

            using (var openFileDialog = new OpenFileDialog
            {
                Filter = filterProtDb,
                InitialDirectory = Settings.Default.ProteomeDbDirectory,
                Title = Resources.BuildBackgroundProteomeDlg_btnOpen_Click_Open_Background_Protoeme,
                CheckFileExists = true,
            })
            {
                if (openFileDialog.ShowDialog(this) == DialogResult.Cancel)
                {
                    return;
                }

                fileName = openFileDialog.FileName;
            }
            Settings.Default.ProteomeDbDirectory = Path.GetDirectoryName(fileName);

            textPath.Text = fileName;
            if (textName.Text.Length == 0)
            {
                textName.Text = Path.GetFileNameWithoutExtension(fileName);
            }
            RefreshStatus();
        }
Esempio n. 5
0
        public static string[] ShowAddFile(Form parent, String initialDirectory)
        {
            var wildExts = new string[RESULTS_EXTS.Length];

            for (int i = 0; i < wildExts.Length; i++)
            {
                wildExts[i] = @"*" + RESULTS_EXTS[i];
            }

            using (var dlg = new OpenFileDialog
            {
                Title = Resources.BuildLibraryDlg_btnAddFile_Click_Add_Input_Files,
                InitialDirectory = initialDirectory,
                CheckPathExists = true,
                SupportMultiDottedExtensions = true,
                Multiselect = true,
                DefaultExt = BiblioSpecLibSpec.EXT,
                Filter = TextUtil.FileDialogFiltersAll(
                    Resources.BuildLibraryDlg_btnAddFile_Click_Matched_Peptides + string.Join(@",", wildExts) + @")|" +
                    string.Join(@";", wildExts),
                    BiblioSpecLiteSpec.FILTER_BLIB)
            })
            {
                if (dlg.ShowDialog(parent) == DialogResult.OK)
                {
                    Settings.Default.LibraryResultsDirectory = Path.GetDirectoryName(dlg.FileName);

                    return(dlg.FileNames);
                }
                return(null);
            }
        }
        private void btnBrowseDb_Click(object sender, EventArgs e)
        {
            if (DatabaseChanged)
            {
                var result = MessageBox.Show(this, Resources.EditIonMobilityLibraryDlg_btnBrowseDb_Click_Are_you_sure_you_want_to_open_a_new_ion_mobility_library_file___Any_changes_to_the_current_library_will_be_lost_,
                                             Program.Name, MessageBoxButtons.YesNo);

                if (result != DialogResult.Yes)
                {
                    return;
                }
            }

            using (OpenFileDialog dlg = new OpenFileDialog
            {
                Title = Resources.EditIonMobilityLibraryDlg_btnBrowseDb_Click_Open_Ion_Mobility_Library,
                InitialDirectory = Settings.Default.ActiveDirectory,
                DefaultExt = IonMobilityDb.EXT,
                Filter = TextUtil.FileDialogFiltersAll(IonMobilityDb.FILTER_IONMOBILITYLIBRARY)
            })
            {
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    Settings.Default.ActiveDirectory = Path.GetDirectoryName(dlg.FileName);

                    OpenDatabase(dlg.FileName);
                    textDatabase.Focus();
                }
            }
        }
Esempio n. 7
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            string filterProtDb = TextUtil.FileDialogFiltersAll(FILTER_PROTDB);

            string fileName;

            using (var saveFileDialog = new SaveFileDialog
            {
                Filter = filterProtDb,
                InitialDirectory = Settings.Default.ProteomeDbDirectory,
                Title = Resources.BuildBackgroundProteomeDlg_btnCreate_Click_Create_Background_Proteome,
                OverwritePrompt = true,
            })
            {
                if (saveFileDialog.ShowDialog(this) == DialogResult.Cancel)
                {
                    return;
                }

                fileName = saveFileDialog.FileName;
            }

            // If the file exists, then the user chose to overwrite,
            // so delete the existing file.
            try
            {
                FileEx.SafeDelete(fileName);
            }
            catch (IOException x)
            {
                MessageDlg.ShowException(this, x);
                return;
            }

            Settings.Default.ProteomeDbDirectory = Path.GetDirectoryName(fileName);

            textPath.Text = fileName;
            if (textName.Text.Length == 0)
            {
                textName.Text = Path.GetFileNameWithoutExtension(fileName);
            }

            try
            {
                ProteomeDb.CreateProteomeDb(fileName);
            }
            catch (Exception x)
            {
                var message = TextUtil.LineSeparate(string.Format(Resources.BuildBackgroundProteomeDlg_btnCreate_Click_An_error_occurred_attempting_to_create_the_proteome_file__0__,
                                                                  fileName), x.Message);
                MessageDlg.ShowWithException(this, message, x);
            }

            RefreshStatus();
        }
Esempio n. 8
0
 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);
         }
     }
 }
Esempio n. 9
0
        public void ShowExportSpectralLibraryDialog(Control owner)
        {
            if (Document.MoleculeTransitionGroupCount == 0)
            {
                MessageDlg.Show(owner, Resources.SkylineWindow_ShowExportSpectralLibraryDialog_The_document_must_contain_at_least_one_peptide_precursor_to_export_a_spectral_library_);
                return;
            }
            else if (!Document.Settings.HasResults)
            {
                MessageDlg.Show(owner, Resources.SkylineWindow_ShowExportSpectralLibraryDialog_The_document_must_contain_results_to_export_a_spectral_library_);
                return;
            }

            using (var dlg = new SaveFileDialog
            {
                Title = Resources.SkylineWindow_ShowExportSpectralLibraryDialog_Export_Spectral_Library,
                OverwritePrompt = true,
                DefaultExt = BiblioSpecLiteSpec.EXT,
                Filter = TextUtil.FileDialogFiltersAll(BiblioSpecLiteSpec.FILTER_BLIB)
            })
            {
                if (!string.IsNullOrEmpty(DocumentFilePath))
                {
                    dlg.InitialDirectory = Path.GetDirectoryName(DocumentFilePath);
                }

                if (dlg.ShowDialog(owner) == DialogResult.Cancel)
                {
                    return;
                }

                try
                {
                    using (var longWaitDlg = new LongWaitDlg
                    {
                        Text = Resources.SkylineWindow_ShowExportSpectralLibraryDialog_Export_Spectral_Library,
                        Message = string.Format(Resources.SkylineWindow_ShowExportSpectralLibraryDialog_Exporting_spectral_library__0____, Path.GetFileName(dlg.FileName))
                    })
                    {
                        longWaitDlg.PerformWork(owner, 800, monitor => ExportSpectralLibrary(dlg.FileName, monitor));
                    }
                }
                catch (Exception x)
                {
                    MessageDlg.ShowWithException(owner, TextUtil.LineSeparate(string.Format(Resources.SkylineWindow_ShowExportSpectralLibraryDialog_Failed_exporting_spectral_library_to__0__, dlg.FileName), x.Message), x);
                }
            }
        }
Esempio n. 10
0
 private void btnBrowse_Click(object sender, System.EventArgs e)
 {
     using (var saveDlg = new SaveFileDialog
     {
         Title = Resources.FilterMidasLibraryDlg_btnBrowse_Click_Export_Filtered_MIDAS_Library,
         OverwritePrompt = true,
         DefaultExt = BiblioSpecLiteSpec.EXT,
         Filter = TextUtil.FileDialogFiltersAll(BiblioSpecLiteSpec.FILTER_BLIB)
     })
     {
         if (saveDlg.ShowDialog(this) == DialogResult.OK)
         {
             FileName = saveDlg.FileName;
         }
     }
 }
Esempio n. 11
0
 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);
         }
     }
 }
Esempio n. 12
0
        private void btnBrowseFile_Click(object sender, EventArgs e)
        {
            using (var dlg = new OpenFileDialog
            {
                CheckPathExists = true,
                DefaultExt = BiblioSpecLibSpec.EXT,
                Filter = TextUtil.FileDialogFiltersAll(IrtDb.FILTER_IRTDB)
            })
            {
                if (dlg.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                textFilePath.Text = dlg.FileName;
            }
        }
Esempio n. 13
0
 public void BrowseDb()
 {
     using (OpenFileDialog dlg = new OpenFileDialog
     {
         Title = Resources.EditIrtCalcDlg_btnBrowseDb_Click_Open_iRT_Database,
         InitialDirectory = Path.GetDirectoryName(DocumentFilePath),
         DefaultExt = IrtDb.EXT,
         Filter = TextUtil.FileDialogFiltersAll(IrtDb.FILTER_IRTDB)
     })
     {
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             Settings.Default.ActiveDirectory = Path.GetDirectoryName(dlg.FileName);
             textOpenDatabase.Text            = dlg.FileName;
             textOpenDatabase.Focus();
         }
     }
 }
Esempio n. 14
0
        private string OpenFileDlg()
        {
            using (var openNewFileDlg = new OpenFileDialog
            {
                Filter = TextUtil.FileDialogFiltersAll(SrmDocument.FILTER_DOC_AND_SKY_ZIP, SrmDocumentSharing.FILTER_SHARING),
                FilterIndex = 1
            })
            {
                if (openNewFileDlg.ShowDialog() != DialogResult.OK)
                {
                    return(null);
                }

                var fileToOpen = openNewFileDlg.InitialDirectory + openNewFileDlg.FileName;
                DialogResult = DialogResult.OK;
                return(fileToOpen);
            }
        }
Esempio n. 15
0
        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(BiblioSpecLiteSpec.FILTER_BLIB)
            })
            {
                if (dlg.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                Settings.Default.LibraryDirectory = Path.GetDirectoryName(dlg.FileName);
                textFilePath.Text = dlg.FileName;
            }
        }
Esempio n. 16
0
 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();
         }
     }
 }
Esempio n. 17
0
        public void Minimize(bool asNewFile)
        {
            var document = DocumentUIContainer.DocumentUI;

            if (!document.Settings.MeasuredResults.IsLoaded)
            {
                MessageDlg.Show(this, Resources.MinimizeResultsDlg_Minimize_All_results_must_be_completely_imported_before_any_can_be_minimized);
                return;
            }
            if (!Settings.DiscardUnmatchedChromatograms && !Settings.NoiseTimeRange.HasValue)
            {
                if (MessageBox.Show(this,
                                    Resources.MinimizeResultsDlg_Minimize_You_have_not_chosen_any_options_to_minimize_your_cache_file_Are_you_sure_you_want_to_continue,
                                    Program.Name, MessageBoxButtons.OKCancel) != DialogResult.OK)
                {
                    return;
                }
            }
            string targetFile = DocumentUIContainer.DocumentFilePath;

            if (asNewFile || string.IsNullOrEmpty(targetFile))
            {
                using (var saveFileDialog =
                           new SaveFileDialog
                {
                    InitialDirectory = Properties.Settings.Default.ActiveDirectory,
                    OverwritePrompt = true,
                    DefaultExt = SrmDocument.EXT,
                    Filter = TextUtil.FileDialogFiltersAll(SrmDocument.FILTER_DOC),
                    FileName = Path.GetFileName(targetFile),
                })
                {
                    if (saveFileDialog.ShowDialog(this) != DialogResult.OK)
                    {
                        return;
                    }
                    targetFile = saveFileDialog.FileName;
                }
            }
            MinimizeToFile(targetFile);
        }
Esempio n. 18
0
        public void OkDialog()
        {
            using (var dlg = new SaveFileDialog
            {
                Title = Resources.ExportReportDlg_OkDialog_Export_Report,
                InitialDirectory = Settings.Default.ExportDirectory,
                OverwritePrompt = true,
                DefaultExt = TextUtil.EXT_CSV,
                Filter = TextUtil.FileDialogFiltersAll(TextUtil.FILTER_CSV, TextUtil.FILTER_TSV)
            })
            {
                if (!string.IsNullOrEmpty(_documentUiContainer.DocumentFilePath))
                {
                    dlg.InitialDirectory = Path.GetDirectoryName(_documentUiContainer.DocumentFilePath);
                    dlg.FileName         = Path.GetFileNameWithoutExtension(_documentUiContainer.DocumentFilePath) + TextUtil.EXT_CSV;
                }

                if (dlg.ShowDialog(this) == DialogResult.Cancel)
                {
                    return;
                }

                string fileName = dlg.FileName;
                char   separator;
                // 1-based index
                switch (dlg.FilterIndex)
                {
                // TSV
                case 2:
                    separator = TextUtil.SEPARATOR_TSV;
                    break;

                // CSV
                default:
                    // Use the local culture CSV separator
                    separator = TextUtil.GetCsvSeparator(CultureInfo);
                    break;
                }
                OkDialog(fileName, separator);
            }
        }
Esempio n. 19
0
 private void btnBrowse_Click(object sender, EventArgs e)
 {
     using (var dlg = new SaveFileDialog
     {
         InitialDirectory = Settings.Default.LibraryDirectory,
         SupportMultiDottedExtensions = true,
         DefaultExt = SrmDocumentSharing.EXT_SKY_ZIP,
         Filter =
             TextUtil.FileDialogFiltersAll(
                 Resources.PublishDocumentDlg_btnBrowse_Click_Skyline_Shared_Documents,
                 SrmDocumentSharing.EXT),
         FileName = tbFilePath.Text,
         Title = Resources.PublishDocumentDlg_btnBrowse_Click_Publish_Document
     })
     {
         if (dlg.ShowDialog(Parent) == DialogResult.OK)
         {
             tbFilePath.Text = dlg.FileName;
         }
     }
 }
Esempio n. 20
0
        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 CreateDb(TextBox textBox)
 {
     using (var dlg = new SaveFileDialog
     {
         Title = Resources.EditIrtCalcDlg_btnCreateDb_Click_Create_iRT_Database,
         InitialDirectory = Path.GetDirectoryName(DocumentFilePath),
         OverwritePrompt = true,
         DefaultExt = IrtDb.EXT,
         Filter = TextUtil.FileDialogFiltersAll(IrtDb.FILTER_IRTDB)
     })
     {
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             Settings.Default.ActiveDirectory = Path.GetDirectoryName(dlg.FileName);
             if (string.IsNullOrEmpty(textCalculatorName.Text))
                 textCalculatorName.Text = Path.GetFileNameWithoutExtension(dlg.FileName);
             textBox.Text = dlg.FileName;
             textBox.Focus();
         }
     }
 }
Esempio n. 22
0
 public bool Export(Control owner, ViewInfo viewInfo)
 {
     using (var saveFileDialog = new SaveFileDialog
     {
         InitialDirectory = GetExportDirectory(),
         OverwritePrompt = true,
         DefaultExt = TextUtil.EXT_CSV,
         Filter = TextUtil.FileDialogFiltersAll(TextUtil.FILTER_CSV, TextUtil.FILTER_TSV),
         FileName = GetDefaultExportFilename(viewInfo),
     })
     {
         // TODO: If document has been saved, initial directory should be document directory
         if (saveFileDialog.ShowDialog(FormUtil.FindTopLevelOwner(owner)) == DialogResult.Cancel)
         {
             return(false);
         }
         char separator = saveFileDialog.FilterIndex == 2
             ? TextUtil.SEPARATOR_TSV
             : TextUtil.GetCsvSeparator(DataSchema.DataSchemaLocalizer.FormatProvider);
         return(ExportToFile(owner, viewInfo, saveFileDialog.FileName, GetDsvWriter(separator)));
     }
 }
Esempio n. 23
0
        public void Rescore(bool asNewFile)
        {
            var document = DocumentUIContainer.DocumentUI;

            if (!document.Settings.HasResults)
            {
                MessageDlg.Show(this, Resources.RescoreResultsDlg_Rescore_There_are_not_results_in_this_document);
                return;
            }
            if (!document.Settings.MeasuredResults.IsLoaded)
            {
                MessageDlg.Show(this, Resources.RescoreResultsDlg_Rescore_All_results_must_be_completely_imported_before_they_can_be_re_scored_);
                return;
            }

            string targetFile = DocumentUIContainer.DocumentFilePath;

            if (asNewFile || string.IsNullOrEmpty(targetFile))
            {
                using (var saveFileDialog =
                           new SaveFileDialog
                {
                    InitialDirectory = Settings.Default.ActiveDirectory,
                    OverwritePrompt = true,
                    DefaultExt = SrmDocument.EXT,
                    Filter = TextUtil.FileDialogFiltersAll(SrmDocument.FILTER_DOC),
                    FileName = Path.GetFileName(targetFile),
                })
                {
                    if (saveFileDialog.ShowDialog(this) != DialogResult.OK)
                    {
                        return;
                    }
                    targetFile = saveFileDialog.FileName;
                }
            }
            RescoreToFile(targetFile);
        }
Esempio n. 24
0
        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;
                }
            }
        }
Esempio n. 25
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            string strSaveFileName  = string.Empty;
            string documentFilePath = null;

            if (null != DataSchema.SkylineWindow)
            {
                documentFilePath = DataSchema.SkylineWindow.DocumentFilePath;
            }
            if (!string.IsNullOrEmpty(documentFilePath))
            {
                strSaveFileName = Path.GetFileNameWithoutExtension(documentFilePath);
            }
            strSaveFileName += "Annotations.csv"; // Not L10N
            bool success;

            using (var dlg = new SaveFileDialog
            {
                FileName = strSaveFileName,
                DefaultExt = TextUtil.EXT_CSV,
                Filter = TextUtil.FileDialogFiltersAll(TextUtil.FILTER_CSV),
                InitialDirectory = Settings.Default.ExportDirectory,
                OverwritePrompt = true,
            })
            {
                if (dlg.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                success = ExportAnnotations(dlg.FileName);
            }
            if (success)
            {
                DialogResult = DialogResult.OK;
            }
        }