/// <summary>Initializes a new instance of the <see cref="GridBlock_1Micro" /> class.</summary> /// <param name="parent">The parent.</param> /// <param name="col">The col.</param> /// <param name="row">The row.</param> /// <param name="microCols">The micro cols.</param> /// <param name="microRows">The micro rows.</param> public GridBlock_2Sub(IGridBlock parent, OnGridCreate onGridCreate, OnGridRowCreate onGridRowCreate, int col, int row, int microCols = 5, int microRows = 5) { _Parent = parent; _Frontend_Caption = $"{row}.{col}"; Reference_Col = col; Reference_Row = row; State_Value = double.NaN; State_Block = enBlockState.Unknown; ChildBlockType = enBlockType.MicroBlock; ChildDisplayType = enBlockDisplayType.Name; ChildDecimalPlaces = 1; _Frontend_Name = parent._Frontend_Name + $"sub{row}_{col}"; _Frontend_CurrentRow = GridBlock_Methods.FrontendCurrentRow(parent, row); onGridCreate?.Invoke(this, enBlockType.SubBlock); // Create the child objects // This can be optimised by only creating a child the momemnt it is neaded in Child_GridBlockGet for (int row1 = 1; row1 <= microRows; row1++) { onGridRowCreate?.Invoke(this, row); for (int col1 = 1; col1 <= microCols; col1++) { var grid = new GridBlock_1Micro(this, onGridCreate, col1, row1); _gridBlockDictionary.Add(grid._Frontend_Caption, grid); } } ChildCount = microRows * microCols; }
/// <summary>Initializes a new instance of the <see cref="GridBlock_1Micro" /> class.</summary> /// <param name="parent">The parent.</param> /// <param name="onGridCreate">The on grid create.</param> /// <param name="onGridRowCreate">The on grid row create.</param> /// <param name="col">The col.</param> /// <param name="row">The row.</param> /// <param name="subCols">The sub cols.</param> /// <param name="subRows">The sub rows.</param> /// <param name="microCols">The micro cols.</param> /// <param name="microRows">The micro rows.</param> public GridBlock_3Macro(IGridblock_Frontend parent, OnGridCreate onGridCreate, OnGridRowCreate onGridRowCreate, int col, int row, int subCols = 5, int subRows = 5, int microCols = 5, int microRows = 5) { _Parent = parent; _Frontend_Caption = $"{row}.{col}"; Reference_Col = col; Reference_Row = row; State_Value = double.NaN; State_Block = enBlockState.Unknown; ChildBlockType = enBlockType.SubBlock; ChildDisplayType = enBlockDisplayType.Name; ChildDecimalPlaces = 1; _Frontend_Name = parent._Frontend_Name + $"mac{row}_{col}"; _Frontend_CurrentRow = GridBlock_Methods.FrontendCurrentRow(parent, row); onGridCreate?.Invoke(this, enBlockType.MacroBlock); // Create the child objects for (int row1 = 1; row1 <= subRows; row1++) { onGridRowCreate?.Invoke(this, row); for (int col1 = 1; col1 <= subCols; col1++) { var grid = new GridBlock_2Sub(this, onGridCreate, onGridRowCreate, col1, row1, microCols: microCols, microRows: microRows); _gridBlockDictionary.Add(grid._Frontend_Caption, grid); } } ChildCount = subRows * subCols * microCols * microRows; }
private void onGridRowCreate(IGridblock_Frontend sender, int rowNo) { tree.Add(sender._Frontend_RowChild); }
private void onGridCreate(IGridblock_Frontend sender, enBlockType blockType) { tree.Add(sender._Frontend_Name); }