public GraphQuantityOverTimeFilter(DashboardCellType cellType, string jsonSettings = "", GraphQuantityOverTime.OnGetColorFromSeriesGraphTypeArgs onGetSeriesColor = null, GetGraphPointsForHQArgs onGetODGraphPointsArgs = null) { InitializeComponent(); //We will turn IsLoading off elsewhere but make sure it is set here to prevent trying to perform FilterData() to soon. graph.IsLoading = true; //Important that CellType is set before other properties as it gives default view. CellType = cellType; ShowFilters = false; graph.LegendDock = LegendDockType.None; SetFilterAndGraphSettings(jsonSettings); _incomeOptionsCtrl.InputsChanged += OnFormInputsChanged; _productionOptionsCtrl.InputsChanged += OnFormInputsChanged; _brokenApptsCtrl.InputsChanged += OnFormInputsChanged; _hqMsgRealTimeCtrl.InputsChanged += OnFormInputsChanged; _onGetSeriesColorOverride = onGetSeriesColor; _onGetODGraphPointsArgs = onGetODGraphPointsArgs; graph.GetRawData = OnGraphGetRawData; }
public void SetCellLayout(int rows, int columns, List <DashboardCell> cells, GraphQuantityOverTime.OnGetColorFromSeriesGraphTypeArgs onGetSeriesColor, GraphQuantityOverTimeFilter.GetGraphPointsForHQArgs onGetODGraphPointsArgs) { try { tableLayoutPanel.SuspendLayout(); tableLayoutPanel.Controls.Clear(); tableLayoutPanel.RowStyles.Clear(); tableLayoutPanel.ColumnStyles.Clear(); tableLayoutPanel.RowCount = rows; tableLayoutPanel.ColumnCount = columns; for (int rowIndex = 0; rowIndex < rows; rowIndex++) { tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent)); tableLayoutPanel.RowStyles[rowIndex].Height = 100 / (float)rows; } for (int columnIndex = 0; columnIndex < columns; columnIndex++) { tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent)); tableLayoutPanel.ColumnStyles[columnIndex].Width = 100 / (float)columns; } for (int rowIndex = 0; rowIndex < rows; rowIndex++) { for (int columnIndex = 0; columnIndex < columns; columnIndex++) { DashboardCell cell = cells.FirstOrDefault(x => x.CellColumn == columnIndex && x.CellRow == rowIndex); DashboardDockContainer cellHolder = null; if (cell != null) { //Currently all CellTypes return GraphQuantityOverTimeFilter. Add a switch here if we ever want to dock a different control type. cellHolder = new GraphQuantityOverTimeFilter(cell.CellType, cell.CellSettings, onGetSeriesColor, onGetODGraphPointsArgs).CreateDashboardDockContainer(cell); } AddCell(columnIndex, rowIndex, cellHolder); } } } finally { tableLayoutPanel.ResumeLayout(); } }
///<summary>Any unsaved changes will be overwritten. Prompt the user to save changes before calling this method.</summary> public void SetDashboardLayout(List <DashboardLayout> layouts, bool invalidateFirst, GraphQuantityOverTime.OnGetColorFromSeriesGraphTypeArgs onGetSeriesColor = null, GraphQuantityOverTimeFilter.GetGraphPointsForHQArgs onGetODGraphPointsArgs = null) { //This may need to be uncommented if user is not being prompted to save changes in certain cases. //_hasUnsavedChanges=false; if (IsEditMode) { while (tabControl.TabCount > 1) //Leave the 'add' tab. { tabControl.TabPages.RemoveAt(0); } } else { while (tabControl.TabCount > 0) //Remove all tabs. { tabControl.TabPages.RemoveAt(0); } } //This will start cache threads. Cache.DashboardCache.RefreshLayoutsIfInvalid(layouts, false, invalidateFirst); this.SuspendLayout(); layouts.OrderBy(x => x.DashboardTabOrder).ToList().ForEach(x => { DashboardPanelCtrl dashboardPanel = new DashboardPanelCtrl(x); dashboardPanel.SetCellLayout(x.DashboardRows, x.DashboardColumns, x.Cells, onGetSeriesColor, onGetODGraphPointsArgs); AddTabPage(x.DashboardTabName, dashboardPanel); }); if (tabControl.TabCount >= 1) { tabControl.SelectedIndex = 0; } this.ResumeLayout(); }