/// <summary> /// Summary type selected /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AggregationTypeMenuItem_Click(object sender, EventArgs e) { PivotGridFieldMx f = PivotGridField; DXMenuItem mi = sender as DXMenuItem; string typeName = mi.Tag.ToString(); // tag is enum member name AggregationTypeDetail atd = AggregationTypeDetail.GetByTypeName(typeName, true); if (atd.IsGroupingType && atd.GroupingType == GroupingTypeEnum.NumericInterval) { DialogResult dr = NumericIntervalDialog.ShowDialog(f.Aggregation, UIMisc.MousePosition); //if (dr == DialogResult.Cancel) return; } f.Aggregation.SetFromTypeName(typeName); f.SyncDxAreaToMxRole(); // sync Dx area PivotGrid.RefreshData(); if (UpdateViewWhenGridControlChanges) { View.UpdateViewFieldsFromGridFields(); } return; }
/// <summary> /// Process aggregation item click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AggregationTypeMenuItem_Click(object sender, EventArgs e) { ToolStripItem mi = sender as ToolStripItem; if (mi.Tag == null) { return; // tag should contain internal AggregationType.Name } string aggTypeName = mi.Tag.ToString(); AggregationTypeDetail atd = AggregationTypeDetail.GetByTypeName(aggTypeName); if (atd == null) { throw new Exception("Unrecognized aggregation type: " + aggTypeName); } if (Qc.MetaColumn == null) { return; } if (Qc.MetaColumn.DataType == MetaColumnType.Structure || Qc.MetaColumn.DataType == MetaColumnType.Image) { bool allowed = ((atd.Role == AggregationRole.DataSummary && atd.SummaryTypeId == SummaryTypeEnum.Count) || atd.Role == AggregationRole.Undefined); if (!allowed) { MessageBoxMx.ShowError("Aggregation is not supported for this column"); return; } } if (atd.GroupingType == GroupingTypeEnum.NumericInterval) // prompt for numeric interval { DialogResult dr = NumericIntervalDialog.ShowDialog(AggregationDef, UIMisc.MousePosition); if (dr != DialogResult.OK) { return; } } AggregationDef.SetFromTypeName(aggTypeName); if (AggregationChangedDelegate != null) { AggregationChangedDelegate(this); } return; }
/// <summary> /// Show the dialog /// </summary> /// <param name="f"></param> /// <param name="location"></param> /// <param name="dialog"></param> public static DialogResult ShowDialog( AggregationDef ad, Point location) { NumericIntervalDialog nfd = new NumericIntervalDialog(); nfd.AggregationDef = ad; // save def ref for later use nfd.IntervalSize.Text = ad.NumericIntervalSize.ToString(); nfd.Location = location; nfd.IntervalSize.Focus(); DialogResult dr = nfd.ShowDialog(); return(dr); }