Example #1
0
        private void RecalcMethodCount(ExportDlgProperties exportProperties,
            string instrument, ExportFileType fileType, SrmDocument document)
        {
            AbstractMassListExporter exporter = null;
            try
            {
                exporter = exportProperties.ExportFile(instrument, fileType, null, document, null);
            }
            catch (IOException)
            {
            }
            catch(ADOException)
            {
            }

            int? methodCount = null;
            if (exporter != null)
                methodCount = exporter.MemoryOutput.Count;
            // Switch back to the UI thread to update the form
            try
            {
                if (IsHandleCreated)
                    Invoke(new Action<int?>(UpdateMethodCount), methodCount);
            }
            // ReSharper disable EmptyGeneralCatchClause
            catch (Exception)
            // ReSharper restore EmptyGeneralCatchClause
            {
                // If disposed, then no need to update the UI
            }
        }
Example #2
0
        public ExportMethodDlg(SrmDocument document, ExportFileType fileType)
        {
            InitializeComponent();

            _exportProperties = new ExportDlgProperties(this);

            _document = document;
            _fileType = fileType;

            string[] listTypes;
            if (_fileType == ExportFileType.Method)
                listTypes = ExportInstrumentType.METHOD_TYPES;
            else
            {
                if (_fileType == ExportFileType.List)
                {
                    Text = Resources.ExportMethodDlg_ExportMethodDlg_Export_Transition_List;
                    listTypes = ExportInstrumentType.TRANSITION_LIST_TYPES;
                }
                else
                {
                    Text = Resources.ExportMethodDlg_ExportMethodDlg_Export_Isolation_List;
                    listTypes = ExportInstrumentType.ISOLATION_LIST_TYPES;
                    _exportProperties.MultiplexIsolationListCalculationTime = 20;   // Default 20 seconds to search for good multiplexed window ordering.
                }

                btnBrowseTemplate.Visible = false;
                labelTemplateFile.Visible = false;
                textTemplateFile.Visible = false;
                Height -= textTemplateFile.Bottom - comboTargetType.Bottom;
            }

            comboInstrument.Items.Clear();
            foreach (string typeName in listTypes)
                comboInstrument.Items.Add(typeName);

            // Init dialog values from settings.
            ExportStrategy = Helpers.ParseEnum(Settings.Default.ExportMethodStrategy, ExportStrategy.Single);

            IgnoreProteins = Settings.Default.ExportIgnoreProteins;

            // Start with method type as Standard until after instrument type is set
            comboTargetType.Items.Add(ExportMethodType.Standard.GetLocalizedString());
            comboTargetType.Items.Add(ExportMethodType.Scheduled.GetLocalizedString());
            comboTargetType.Items.Add(ExportMethodType.Triggered.GetLocalizedString());
            MethodType = ExportMethodType.Standard;

            // Add optimizable regressions
            comboOptimizing.Items.Add(ExportOptimize.NONE);
            comboOptimizing.Items.Add(ExportOptimize.CE);
            if (document.Settings.TransitionSettings.Prediction.DeclusteringPotential != null)
                comboOptimizing.Items.Add(ExportOptimize.DP);
            comboOptimizing.SelectedIndex = 0;

            // Set instrument type based on CE regression name for the document.
            string instrumentTypeName = document.Settings.TransitionSettings.Prediction.CollisionEnergy.Name;
            if (instrumentTypeName != null)
            {
                // Look for the first instrument type with the same prefix as the CE name
                string instrumentTypePrefix = instrumentTypeName.Split(' ')[0];
                // We still have some CE regressions that begin with ABI, while all instruments
                // have been changed to AB SCIEX
                if (Equals("ABI", instrumentTypePrefix)) // Not L10N
                    instrumentTypePrefix = "AB"; // Not L10N
                int i = -1;
                if (document.Settings.TransitionSettings.FullScan.IsEnabled)
                {
                    i = listTypes.IndexOf(typeName => typeName.StartsWith(instrumentTypePrefix) &&
                        ExportInstrumentType.IsFullScanInstrumentType(typeName));
                }
                if (i == -1)
                {
                    i = listTypes.IndexOf(typeName => typeName.StartsWith(instrumentTypePrefix));
                }
                if (i != -1)
                    InstrumentType = listTypes[i];
            }
            // If nothing found based on CE regression name, just use the first instrument in the list
            if (InstrumentType == null)
                InstrumentType = listTypes[0];

            // Reset method type based on what was used last and what the chosen instrument is capable of
            ExportMethodType mType = Helpers.ParseEnum(Settings.Default.ExportMethodType, ExportMethodType.Standard);
            if (mType == ExportMethodType.Triggered && !CanTrigger)
            {
                mType = ExportMethodType.Scheduled;
            }
            if (mType != ExportMethodType.Standard && !CanSchedule)
            {
                mType = ExportMethodType.Standard;
            }
            MethodType = mType;

            DwellTime = Settings.Default.ExportMethodDwellTime;
            RunLength = Settings.Default.ExportMethodRunLength;

            UpdateMaxTransitions();

            cbEnergyRamp.Checked = Settings.Default.ExportThermoEnergyRamp;
            cbTriggerRefColumns.Checked = Settings.Default.ExportThermoTriggerRef;
            cbExportMultiQuant.Checked = Settings.Default.ExportMultiQuant;
            cbExportEdcMass.Checked = Settings.Default.ExportEdcMass;
            textPrimaryCount.Text = Settings.Default.PrimaryTransitionCount.ToString(LocalizationHelper.CurrentCulture);
            // Reposition from design layout
            panelThermoColumns.Top = labelDwellTime.Top;
            panelThermoRt.Top = panelThermoColumns.Top - (int)(panelThermoRt.Height*0.8);
            panelAbSciexTOF.Top = textDwellTime.Top + (textDwellTime.Height - panelAbSciexTOF.Height)/2;
            panelTriggered.Top = textDwellTime.Top + (textDwellTime.Height - panelTriggered.Height)/2;
            panelSciexTune.Top = labelOptimizing.Top;
            panelWaters.Top = labelDwellTime.Top - panelWaters.Height;

            foreach (string tuneType in ExportOptimize.CompensationVoltageTuneTypes)
                comboTuning.Items.Add(tuneType);
            comboTuning.SelectedIndex = 0;

            // Further repositioning - for design layout convenience we have many things to the right of the OK button.
            // Find all such items and shift them to the left, then resize the form itself.
            foreach (var controlObj in Controls)
            {
                var control = controlObj as Control;
                if ((control != null) && (control.Left > btnOk.Right))
                {
                    control.Left = cbIgnoreProteins.Left; // Align with a known-good control
                }
            }
            SetBounds(Left, Top, btnOk.Right + 2 * label4.Left, Height);
        }