Пример #1
0
        /// <summary>
        /// Duplicate an existing field
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void DuplicatePivotField_Click(object sender, EventArgs e)
        {
            int[] rows = FieldGridView.GetSelectedRows();
            if (rows.Length == 0)
            {
                return;
            }

            PivotGrid.BeginUpdate();
            object ds = PivotGrid.DataSource;

            PivotGrid.DataSource = null;

            PivotGridFieldMx f = PivotGrid.Fields[rows[0]] as PivotGridFieldMx;

            if (f == null)
            {
                return;
            }

            PivotGridFieldMx f2 = new PivotGridFieldMx();

            f.CopyField(f2);
            PivotGrid.Fields.Add(f2);

            PivotGrid.DataSource = ds;
            PivotGrid.EndUpdate();

            FillFieldDetailsGrid();
            return;
        }
Пример #2
0
/// <summary>
/// Aggregation role changed
/// </summary>
/// <param name="ats"></param>

        private void AggregationRoleChanged(AggregationDefMenus ats)
        {
            FieldGridView.SetRowCellValue(FieldGridRow, "AggRoleCol", Field.Aggregation.RoleLabel);
            FieldGridView.SetRowCellValue(FieldGridRow, "AggTypeCol", Field.Aggregation.TypeLabel);
            Field.SyncDxAreaToMxRole();          // sync Dx area
            PivotGrid.RefreshData();             // refresh the PivotGrid to show new agg type results
        }
Пример #3
0
        public MainWindow()
        {
            InitializeComponent();
            FieldGridView startMenuForCardGameView = new FieldGridView();

            startMenuForCardGameView.Show();
            this.Close();
        }
Пример #4
0
        /// <summary>
        /// Store selected group interval type
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void AggregationTypeChanged(AggregationDefMenus ats)
        {
            FieldGridView.SetRowCellValue(FieldGridRow, "AggTypeCol", Field.Aggregation.TypeLabel);
            Field.SyncDxAreaToMxRole();          // sync Dx area
            PivotGrid.RefreshData();             // refresh the PivotGrid to show new agg type results

            //PivotGrid.BeginUpdate();
            //object ds = PivotGrid.DataSource;
            //PivotGrid.DataSource = null;
            // -make changes
            //PivotGrid.DataSource = ds;
            //PivotGrid.EndUpdate();
        }
Пример #5
0
        //void SetMeasureUnits(params DateTimeMeasureUnit[] units)
        //{
        //	object prevUnit = String.IsNullOrEmpty(ChartDataMeasureUnit.SelectedItem.ToString()) ? null : Enum.Parse(typeof(DateTimeMeasureUnit), ChartDataMeasureUnit.SelectedItem.ToString());
        //	string prevItem = "";
        //	ChartDataMeasureUnit.Properties.Items.Clear();
        //	foreach (DateTimeMeasureUnit unit in units)
        //	{
        //		string unitName = Enum.GetName(typeof(DateTimeMeasureUnit), unit);
        //		ChartDataMeasureUnit.Properties.Items.Add(unitName);
        //		if (prevUnit != null && object.Equals(unit, (DateTimeMeasureUnit)prevUnit))
        //			prevItem = unitName;
        //	}
        //	if (!String.IsNullOrEmpty(prevItem))
        //		ChartDataMeasureUnit.SelectedItem = prevItem;
        //	else
        //		ChartDataMeasureUnit.SelectedIndex = 0;
        //}


        //private void cbChartDataMeasureUnit_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //	XYDiagram diagram = null; // (XYDiagram)Chart.Diagram;
        //	DateTimeMeasureUnit unit = (DateTimeMeasureUnit)Enum.Parse(typeof(DateTimeMeasureUnit), ChartDataMeasureUnit.SelectedItem.ToString());
        //	diagram.AxisX.DateTimeScaleOptions.GridAlignment = (DateTimeGridAlignment)unit;
        //	diagram.AxisX.DateTimeScaleOptions.MeasureUnit = unit;
        //	switch (unit)
        //	{
        //		case DateTimeMeasureUnit.Year:
        //			diagram.AxisX.Label.TextPattern = "{A:yyyy}";
        //			break;
        //		case DateTimeMeasureUnit.Quarter:
        //			diagram.AxisX.Label.TextPattern = "{A:yyyy}"; // todo: fix
        //			//diagram.AxisX.Label.DateTimeOptions.Format = DateTimeFormat.QuarterAndYear;
        //			break;
        //		case DateTimeMeasureUnit.Month:
        //			diagram.AxisX.Label.TextPattern = "{A:yyyy}"; // todo: fix
        //			//diagram.AxisX.DateTimeOptions.Format = DateTimeFormat.MonthAndYear;
        //			break;
        //		default:
        //			break;
        //	}
        //}

/// <summary>
/// Field grid cell clicked
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

        private void FieldGrid_MouseClick(object sender, MouseEventArgs e)
        {
            GridHitInfo hi = FieldGridView.CalcHitInfo(e.Location);
            int         ri = hi.RowHandle;

            if (ri < 0)
            {
                return;
            }

            PivotGridFieldMx f    = Field = PivotGrid.Fields[ri] as PivotGridFieldMx;
            ResultsField     rfld = f.ResultsField as ResultsField;
            AggregationDef   agg  = f.Aggregation;

            Mobius.Data.QueryColumn qc = rfld.QueryColumn;
            MetaColumn mc = qc.MetaColumn;

            GridColumn gc = hi.Column;

            if (gc == null)
            {
                return;
            }

            FieldGridRow    = hi.RowHandle;
            FieldGridColumn = gc.AbsoluteIndex;

            GridViewInfo viewInfo = (GridViewInfo)FieldGridView.GetViewInfo();
            GridCellInfo cellInfo = viewInfo.GetGridCellInfo(hi);
            Point        menuLoc  = new Point(cellInfo.Bounds.Left, cellInfo.Bounds.Bottom);

            menuLoc = FieldGrid.PointToScreen(menuLoc);

            if (gc.FieldName == "AggRoleCol")             // show appropriate aggregation type menu
            {
                AggregationDefMenus.ShowRoleMenu(qc, f.Aggregation, menuLoc, AggregationRoleChanged);
                return;
            }


            else if (gc.FieldName == "AggTypeCol")             // show appropriate aggregation type menu
            {
                AggregationDefMenus.ShowTypeMenu(qc, f.Aggregation, menuLoc, AggregationTypeChanged);
                return;
            }

            else if (gc.FieldName == "SourceColumnCol" || gc.FieldName == "SourceTableCol")
            {
                return;
            }
        }
Пример #6
0
        /// <summary>
        /// Delete the pivot fields corresponding to the currently selected rows in the  field grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void DeletePivotField_Click(object sender, EventArgs e)
        {
            int[] rows = FieldGridView.GetSelectedRows();
            if (rows.Length == 0)
            {
                return;
            }

            PivotGrid.BeginUpdate();
            object ds = PivotGrid.DataSource;

            PivotGrid.DataSource = null;

            for (int ri = rows.Length - 1; ri >= 0; ri--)
            {
                PivotGrid.Fields.RemoveAt(rows[ri]);               // delete pivot field from pivot grid control
                FieldGridView.DeleteRow(rows[ri]);                 // also from the field grid
            }

            PivotGrid.DataSource = ds;
            PivotGrid.EndUpdate();

            return;
        }