protected void SetRowColor(fsParametersWithValuesTable dataGrid, int ind, Color color) { foreach (DataGridViewCell cell in dataGrid.Rows[ind].Cells) { cell.Style.BackColor = color; } }
protected void AddRow(fsParametersWithValuesTable dataGrid, fsSimulationModuleParameter parameter, Color color) { int rowIndex = dataGrid.Rows.Add(new[] { parameter.Identifier.Name, parameter.Unit.Name, "" }); int valueColIndex = dataGrid.Rows[rowIndex].Cells.Count - 1; SetRowColor(dataGrid, rowIndex, color); AssignParameterAndCell(parameter.Identifier, dataGrid.Rows[rowIndex].Cells[valueColIndex]); dataGrid.Rows[rowIndex].Cells[0].ToolTipText = parameter.Identifier.FullName + " (" + parameter.Identifier.Name + ")"; }
protected void AddGroupToUI(fsParametersWithValuesTable dataGrid, fsParametersGroup group, Color color) { foreach (fsParameterIdentifier identifier in group.Parameters) { if (!Values.ContainsKey(identifier)) { var parameter = new fsSimulationModuleParameter(identifier); var defaultRanges = fsMachineRanges.DefaultMachineRanges.Ranges; if (defaultRanges.ContainsKey(identifier)) { parameter.Range = fsMachineRanges.DefaultMachineRanges.Ranges[identifier].Range; } Values.Add(identifier, parameter); AddRow(dataGrid, parameter, color); } else { AddRow(dataGrid, Values[identifier], color); } } }
protected void AddGroupsToUI(fsParametersWithValuesTable dataGrid, fsParametersGroup[] groups) { if (groups == null) { return; } var colors = new[] { Color.FromArgb(255, 255, 230), Color.FromArgb(255, 230, 255) }; dataGrid.Rows.Clear(); for (int i = 0; i < groups.Length; ++i) { AddGroupToUI(dataGrid, groups[i], colors[i % colors.Length]); SetGroupInput(groups[i], true); } }