private void CheckAndChange(object sender, EventArgs e) { ClustererBase stat = (ClustererBase)this._ecbMethod.SelectedItem; MetricBase met = this._ecbMeasure.SelectedItem as MetricBase; // Stat has params? bool paramsVisible = stat != null && stat.Parameters.HasCustomisableParams; this._txtParams.Enabled = paramsVisible; this._btnEditParameters.Enabled = paramsVisible; this._lblParams.Enabled = paramsVisible; this._lblParams.Text = paramsVisible ? stat.Parameters.ParamNames() : "Parameters"; // Distance this.linkLabel1.Visible = stat != null && !stat.SupportsDistanceMetrics; // Distance params bool distParamsVisible = met != null && met.Parameters != null && met.Parameters.HasCustomisableParams; this._txtMeasureParams.Enabled = distParamsVisible; this._btnEditDistanceParameters.Enabled = distParamsVisible; this._lblMeasureParams.Enabled = distParamsVisible; this._lblMeasureParams.Text = distParamsVisible ? met.Parameters.ParamNames() : "Parameters"; // Input vector bool obsFilterVisible = stat != null && stat.SupportsObservationFilters; this._lblApply.Visible = obsFilterVisible; this._ecbSource.Enabled = obsFilterVisible; //_btnTrendHelp.Enabled = obsFilterVisible; this._lblAVec.Enabled = obsFilterVisible; this._ecbObsFilter.Enabled = obsFilterVisible; this._chkSepGroups.Enabled = obsFilterVisible; // Is OK? this.Check(null, null); }
private void _btnEditParameters_Click(object sender, EventArgs e) { ClustererBase stat = (ClustererBase)this._ecbMethod.SelectedItem; FrmEditParameters.Show(stat, this._txtParams, this._core, this._readOnly); }
private ArgsClusterer GetSelection() { IMatrixProvider src; PeakFilter peakFilter; ObsFilter obsFilter; string title; string shortName; this._checker.Clear(); // Selection ClustererBase sel = (ClustererBase)this._ecbMethod.SelectedItem; // Title / comments title = string.IsNullOrWhiteSpace(this._txtName.Text) ? null : this._txtName.Text; shortName = string.IsNullOrWhiteSpace(this._txtShortName.Text) ? null : this._txtShortName.Text; // Parameters object[] parameters; if (sel != null) { string error; parameters = sel.Parameters.TryStringToParams(this._core, this._txtParams.Text, out error); this._checker.Check(this._txtParams, parameters != null, error ?? "error"); } else { parameters = null; this._checker.Check(this._ecbMethod.ComboBox, false, "A method is required."); } // Peak filter peakFilter = this._ecbPeakFilter.SelectedItem; this._checker.Check(this._ecbPeakFilter.ComboBox, this._ecbPeakFilter.HasSelection, "Select a valid peak filter"); // Suppress metric EClustererStatistics suppressMetric; if (this._cbStatistics.SelectionValid) { suppressMetric = (EClustererStatistics)this._cbStatistics.SelectedItems.Cast <int>().Sum(); } else { this._checker.Check(this._cbStatistics.TextBox, false, "Select a valid set of statistics"); suppressMetric = default(EClustererStatistics); } // Distance metric MetricBase dMet; dMet = (MetricBase)this._ecbMeasure.SelectedItem; // Distance metric params object[] dMetParams; if (dMet != null) { string error; dMetParams = dMet.Parameters.TryStringToParams(this._core, this._txtMeasureParams.Text, out error); this._checker.Check(this._txtMeasureParams, dMetParams != null, error ?? "error"); } else { this._checker.Check(this._ecbMeasure.ComboBox, false, "Specify a distance measure"); dMetParams = null; } // Obs source src = this._ecbSource.SelectedItem; if (sel != null && sel.SupportsObservationFilters) { this._checker.Check(this._ecbSource.ComboBox, src != null, "Select a valid source"); } _lblRepWarn.Visible = HasReplicates(src); // Vector A if (sel == null || !sel.SupportsObservationFilters) { obsFilter = null; } else if (this._ecbObsFilter.HasSelection) { obsFilter = this._ecbObsFilter.SelectedItem; } else { this._checker.Check(this._ecbObsFilter.ComboBox, false, "Select a valid observation filter"); obsFilter = default(ObsFilter); } if (this._checker.HasErrors) { return(null); } // Result ConfigurationMetric df = dMet != null ? new ConfigurationMetric() : null; if (df != null) { df.Args = new ArgsMetric(dMet.Id, src, dMetParams) { OverrideDisplayName = dMet.DisplayName }; } ArgsClusterer args = new ArgsClusterer(sel.Id, src, peakFilter, df, obsFilter, this._chkSepGroups.Checked, suppressMetric, parameters, shortName) { OverrideDisplayName = title, Comment = this._comment }; return(args); }