internal static ArgsTrend Show(Form owner, Core core, ArgsTrend def, bool readOnly)
        {
            if (FrmEditConfigurationStatistic.ShowCannotEditError(owner, def))
            {
                return(null);
            }

            using (FrmEditConfigurationTrend frm = new FrmEditConfigurationTrend(core, FrmMain.SearchForSelectedPeak(owner), def, readOnly))
            {
                if (UiControls.ShowWithDim(owner, frm) == DialogResult.OK)
                {
                    return(frm.GetSelection());
                }

                return(null);
            }
        }
        internal FrmEditConfigurationTrend(Core core, Peak previewPeak, ArgsTrend def, bool readOnly)
            : this()
        {
            this._core        = core;
            this._previewPeak = previewPeak;

            this._ecbMethod = DataSet.ForTrendAlgorithms(core).CreateComboBox(this._lstMethod, this._btnNewStatistic, EditableComboBox.EFlags.None);
            this._ecbSource = DataSet.ForMatrixProviders(core).CreateComboBox(this._lstSource, this._btnSource, EditableComboBox.EFlags.None);

            this._chart1 = new ChartHelperForPeaks(null, core, this.panel1);

            if (def != null)
            {
                this._txtName.Text           = def.OverrideDisplayName;
                this._ecbMethod.SelectedItem = (TrendBase)def.GetAlgorithmOrNull();
                this._comments               = def.Comment;
                this._txtParams.Text         = AlgoParameterCollection.ParamsToReversableString(def.Parameters, core);
                this._ecbSource.SelectedItem = def.SourceProvider;
            }

            this.CheckAndChange(null, null);

            this._readOnly = readOnly;

            if (readOnly)
            {
                UiControls.MakeReadOnly(this, this._tlpPreview);

                this._btnComment.Enabled = true;

                this.ctlTitleBar1.Text = "View Trend";
            }
            else if (def != null)
            {
                this.ctlTitleBar1.Text = "Edit Trend";
            }
            else
            {
                this.ctlTitleBar1.Text = "New Trend";
            }

            // UiControls.CompensateForVisualStyles(this);
        }