private FrmEditConfigurationStatistic(Core core, ArgsStatistic defaultSelection, Peak defaultPeak, bool readOnly) : this() { this._core = core; this._previewPeak = defaultPeak; this._ecbFilter1 = DataSet.ForObsFilter(core).CreateComboBox(this._lstFilter1, this._btnFilter1, EditableComboBox.EFlags.IncludeAll); this._ecbFilter2 = DataSet.ForObsFilter(core).CreateComboBox(this._lstFilter2, this._btnFilter2, EditableComboBox.EFlags.IncludeAll); this._ecbSource = DataSet.ForMatrixProviders(core).CreateComboBox(this._lstSource, this._btnSource, EditableComboBox.EFlags.None); this._ecbMeasure = DataSet.ForStatisticsAlgorithms(core).CreateComboBox(this._lstMethod, this._btnNewStatistic, EditableComboBox.EFlags.None); this._ecbDiffPeak = DataSet.ForPeaks(core).CreateComboBox(this._lstDiffPeak, this._btnSelectDiffPeak, EditableComboBox.EFlags.None); this._ecbDiffPeak.SelectedItem = defaultPeak; if (defaultSelection != null) { this._txtName.Text = defaultSelection.OverrideDisplayName; this.ctlTitleBar1.SubText = defaultSelection.AlgoName; this._comments = defaultSelection.Comment; this._ecbMeasure.SelectedItem = (StatisticBase)defaultSelection.GetAlgorithmOrNull(); this._txtParams.Text = AlgoParameterCollection.ParamsToReversableString(defaultSelection.Parameters, this._core); this._ecbSource.SelectedItem = defaultSelection.SourceProvider; this._radBCorTime.Checked = defaultSelection.VectorBSource == EAlgoInputBSource.Time; this._radBDiffPeak.Checked = defaultSelection.VectorBSource == EAlgoInputBSource.AltPeak; this._radSamePeak.Checked = defaultSelection.VectorBSource == EAlgoInputBSource.SamePeak; this._ecbFilter1.SelectedItem = defaultSelection.VectorAConstraint; this._ecbFilter2.SelectedItem = defaultSelection.VectorBConstraint; if (defaultSelection.VectorBPeak != null) { this._ecbDiffPeak.SelectedItem = defaultSelection.VectorBPeak; } } this.SetStatuses(); this._readOnly = readOnly; if (readOnly) { UiControls.MakeReadOnly(this, this._tlpPreivew); this._btnComment.Enabled = true; this.ctlTitleBar1.Text = "View Statistic"; } else if (defaultSelection != null) { this.ctlTitleBar1.Text = "Edit Statistic"; } else { this.ctlTitleBar1.Text = "New Statistic"; } // UiControls.CompensateForVisualStyles(this); }
internal FrmEditConfigurationCorrection(Core core, ArgsCorrection def, bool readOnly, Peak previewPeak) { this.InitializeComponent(); UiControls.SetIcon(this); this._lblPreviewTitle.BackColor = UiControls.PreviewBackColour; this._lblPreviewTitle.ForeColor = UiControls.PreviewForeColour; this._flpPreviewButtons.BackColor = UiControls.PreviewBackColour; this._flpPreviewButtons.ForeColor = UiControls.PreviewForeColour; this._core = core; this._readOnly = readOnly; this._selectedPeak = previewPeak; // Charts this._chartOrig = new ChartHelperForPeaks(null, this._core, this.panel1); this._chartChanged = new ChartHelperForPeaks(null, this._core, this.panel2); // Choicelists this._ecbFilter = DataSet.ForObsFilter(core).CreateComboBox(this._lstFilter, this._btnFilter, EditableComboBox.EFlags.IncludeAll); this._ecbMethod = DataSet.ForTrendAndCorrectionAlgorithms(core).CreateComboBox(this._lstMethod, this._btnNewStatistic, EditableComboBox.EFlags.None); this._ecbTypes = DataSet.ForGroups(this._core).CreateComboBox(this._lstTypes, this._btnEditTypes, EditableComboBox.EFlags.None); this._ecbSource = DataSet.ForMatrixProviders(this._core).CreateComboBox(this._lstSource, this._btnSource, EditableComboBox.EFlags.None); // Buttons this.GenerateTypeButtons(); // Default if (def != null) { this._txtName.Text = def.OverrideDisplayName; this._txtParameters.Text = AlgoParameterCollection.ParamsToReversableString(def.Parameters, core); this._ecbMethod.SelectedItem = def.GetAlgorithmOrNull(); this._comments = def.Comment; if (def.IsUsingTrend) { this._radBatch.Checked = def.Mode == ECorrectionMode.Batch; this._radType.Checked = def.Mode == ECorrectionMode.Control; this._radDivide.Checked = def.Method == ECorrectionMethod.Divide; this._radSubtract.Checked = def.Method == ECorrectionMethod.Subtract; this._ecbTypes.SelectedItem = def.ControlGroup; this._ecbFilter.SelectedItem = def.Constraint; } } this.CheckAndChange(); if (readOnly) { UiControls.MakeReadOnly(this, this._tlpPreview); } }
private void _btnOk_Click(object sender, EventArgs e) { object[] results = new object[this._parameters.Count]; for (int index = 0; index < this._parameters.Count; index++) { var param = this._parameters[index]; var args = new FromStringArgs(this._core, this._textBoxes[index].Text); results[index] = param.Type.FromString(args); Debug.Assert(results[index] != null, $"The {{{param.Name}}} parameter is invalid (the OK button should have been disabled).\r\n" + args.Error); } this._result = AlgoParameterCollection.ParamsToReversableString(results, this._core); this.DialogResult = DialogResult.OK; }
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); }
private FrmEditConfigurationCluster(Core core, ArgsClusterer def, bool readOnly, bool hideOptimise) : this() { this._core = core; this._ecbPeakFilter = DataSet.ForPeakFilter(core).CreateComboBox(this._lstPeakFilter, this._btnPeakFilter, EditableComboBox.EFlags.IncludeAll); this._ecbObsFilter = DataSet.ForObsFilter(core).CreateComboBox(this._lstObsFilter, this._btnObsFilter, EditableComboBox.EFlags.IncludeAll); this._ecbMethod = DataSet.ForClustererAlgorithms(core).CreateComboBox(this._lstMethod, this._btnNewStatistic, EditableComboBox.EFlags.CreateSelection); this._ecbMeasure = DataSet.ForMetricAlgorithms(core).CreateComboBox(this._lstMeasure, this._btnNewDistance, EditableComboBox.EFlags.IncludeNone); this._ecbSource = DataSet.ForMatrixProviders(core).CreateComboBox(this._lstSource, this._btnSource, EditableComboBox.EFlags.None); this._cbStatistics = DataSet.ForFlagsEnum <EClustererStatistics>(this._core, "Cluster Statistics").CreateConditionBox(this._txtStatistics, this._btnSetStatistics); this._readOnly = readOnly; if (def != null) { // Name this._txtName.Text = def.OverrideDisplayName; this._txtShortName.Text = def.OverrideShortName; // Comment this._comment = def.Comment; // Method this._ecbMethod.SelectedItem = (ClustererBase)def.GetAlgorithmOrNull(); // Params this._txtParams.Text = AlgoParameterCollection.ParamsToReversableString(def.Parameters, core); // PeakFilter this._ecbPeakFilter.SelectedItem = def.PeakFilter; // Distance this._ecbMeasure.SelectedItem = def.Distance != null ? (MetricBase)def.Distance.Args.GetAlgorithmOrNull() : null; // Distance params this._txtMeasureParams.Text = StringHelper.ArrayToString(def.Distance?.Args.Parameters); // Suppress distance this._cbStatistics.SelectedItems = EnumHelper.SplitEnum <EClustererStatistics>(def.Statistics); // Input vector this._ecbSource.SelectedItem = def.SourceProvider; // ObsFilter this._ecbObsFilter.SelectedItem = def.ObsFilter; // Seperate groups this._chkSepGroups.Checked = def.SplitGroups; } if (readOnly) { UiControls.MakeReadOnly(this); this._btnParameterOptimiser.Visible = false; this._btnComment.Enabled = true; this.ctlTitleBar1.Text = "View Clustering Algorithm"; } else if (def != null) { this.ctlTitleBar1.Text = "Edit Clustering Algorithm"; } else { this.ctlTitleBar1.Text = "New Clustering Algorithm"; } this.CheckAndChange(null, null); // UiControls.CompensateForVisualStyles(this); if (hideOptimise) { this._btnParameterOptimiser.Visible = false; this._btnOk.Text = "Continue"; } }