Example #1
0
        public void OkDialog()
        {
            if (_chromExtractors.Count == 0 && _chromSources.Count == 0)
            {
                MessageDlg.Show(this, Resources.ExportChromatogramDlg_OkDialog_At_least_one_chromatogram_type_must_be_selected);
                return;
            }
            if (checkedListVars.CheckedItems.Count == 0)
            {
                MessageDlg.Show(this, Resources.ExportChromatogramDlg_OkDialog_At_least_one_file_must_be_selected);
                return;
            }
            using (var dlg = new SaveFileDialog
            {
                Title = Resources.ExportChromatogramDlg_OkDialog_Export_Chromatogram,
                OverwritePrompt = true,
                DefaultExt = EXT,
                Filter = TextUtil.FileDialogFilterAll(Resources.ExportChromatogramDlg_OkDialog_Chromatogram_Export_Files, EXT),
            })
            {
                if (!string.IsNullOrEmpty(DocumentFilePath))
                {
                    dlg.InitialDirectory = Path.GetDirectoryName(DocumentFilePath);
                    dlg.FileName         = Path.GetFileNameWithoutExtension(DocumentFilePath) + EXT;
                }
                if (dlg.ShowDialog(this) == DialogResult.Cancel)
                {
                    return;
                }
                WriteChromatograms(dlg.FileName);
            }

            DialogResult = DialogResult.OK;
        }
Example #2
0
 public void ShowShare()
 {
     CheckDisposed();
     using (var dlg = new ShareListDlg <ReportSpecList, ReportSpec>(Settings.Default.ReportSpecList)
     {
         Label = Resources.ExportReportDlg_ShowShare_Report_Definitions,
         Filter = TextUtil.FileDialogFilterAll(Resources.ExportReportDlg_ShowShare_Skyline_Reports, ReportSpecList.EXT_REPORTS)
     })
     {
         dlg.ShowDialog(this);
     }
 }
Example #3
0
        // ReSharper restore NonLocalizedString

        public override void ExportViews(Control owner, ViewSpecList viewSpecList)
        {
            using (var saveFileDialog = new SaveFileDialog
            {
                InitialDirectory = Settings.Default.ActiveDirectory,
                CheckPathExists = true,
                Filter = TextUtil.FileDialogFilterAll(Resources.ExportReportDlg_ShowShare_Skyline_Reports, ReportSpecList.EXT_REPORTS)
            })
            {
                saveFileDialog.ShowDialog(FormUtil.FindTopLevelOwner(owner));
                if (!string.IsNullOrEmpty(saveFileDialog.FileName))
                {
                    ExportViewsToFile(owner, viewSpecList, saveFileDialog.FileName);
                }
            }
        }
Example #4
0
        public override void ImportViews(Control owner, ViewGroup group)
        {
            using (var importDialog = new OpenFileDialog
            {
                InitialDirectory = Settings.Default.ActiveDirectory,
                CheckPathExists = true,
                Filter = TextUtil.FileDialogFilterAll(Resources.ExportReportDlg_ShowShare_Skyline_Reports,
                                                      ReportSpecList.EXT_REPORTS)
            })
            {
                importDialog.ShowDialog(FormUtil.FindTopLevelOwner(owner));

                if (string.IsNullOrEmpty(importDialog.FileName))
                {
                    return;
                }
                ImportViewsFromFile(owner, group, importDialog.FileName);
            }
        }
Example #5
0
 private void btnImport_Click(object sender, EventArgs e)
 {
     Import(ShareListDlg <ReportSpecList, ReportSpec> .GetImportFileName(this,
                                                                         TextUtil.FileDialogFilterAll(Resources.ExportReportDlg_ShowShare_Skyline_Reports, ReportSpecList.EXT_REPORTS)));
 }
Example #6
0
        public void OkDialog()
        {
            using (var dlg = new SaveFileDialog
            {
                Title = Resources.MProphetFeaturesDlg_OkDialog_Export_mProphet_Features,
                OverwritePrompt = true,
                DefaultExt = EXT,
                Filter = TextUtil.FileDialogFilterAll(Resources.MProphetFeaturesDlg_OkDialog_mProphet_Feature_Files, EXT),
            })
            {
                if (!string.IsNullOrEmpty(DocumentFilePath))
                {
                    dlg.InitialDirectory = Path.GetDirectoryName(DocumentFilePath);
                    dlg.FileName         = Path.GetFileNameWithoutExtension(DocumentFilePath) + EXT;
                }
                if (dlg.ShowDialog(this) == DialogResult.Cancel)
                {
                    return;
                }

                var displayCalcs = new List <IPeakFeatureCalculator>();
                displayCalcs.AddRange(from object calcName in checkedListVars.CheckedItems select GetCalcFromName(calcName.ToString()));

                IPeakScoringModel currentPeakScoringModel = Document.Settings.PeptideSettings.Integration.PeakScoringModel;
                var mProphetScoringModel = currentPeakScoringModel as MProphetPeakScoringModel;
//                if (mProphetScoringModel == null)
//                {
//                    MessageDlg.Show(this, Resources.MProphetFeaturesDlg_OkDialog_To_export_MProphet_features_first_train_an_MProphet_model_);
//                    return;
//                }
                var resultsHandler = new MProphetResultsHandler(Document, mProphetScoringModel);

                using (var longWaitDlg = new LongWaitDlg
                {
                    Text = Resources.SkylineWindow_OpenSharedFile_Extracting_Files,
                })
                {
                    try
                    {
                        longWaitDlg.PerformWork(this, 1000, b =>
                                                WriteFeatures(dlg.FileName,
                                                              resultsHandler,
                                                              displayCalcs,
                                                              LocalizationHelper.CurrentCulture,
                                                              checkBoxBestOnly.Checked,
                                                              !checkBoxTargetsOnly.Checked,
                                                              b));
                        if (longWaitDlg.IsCanceled)
                        {
                            return;
                        }
                    }
                    catch (Exception x)
                    {
                        var message = TextUtil.LineSeparate(string.Format(Resources.MProphetFeaturesDlg_OkDialog_Failed_attempting_to_save_mProphet_features_to__0__, dlg.FileName),
                                                            x.Message);
                        MessageDlg.ShowWithException(this, message, x);
                    }
                }
            }

            DialogResult = DialogResult.OK;
        }