private void dgHyperionAddress_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && e.ColumnIndex == dgHyperionAddress.Columns["clmnProtocol"].Index) { var columnValue = dgHyperionAddress.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; if (columnValue != null) { var serverProtocol = (HyperionServerProtocol)columnValue; int newPortValue = -1; switch (serverProtocol) { case HyperionServerProtocol.FLAT_BUFFERS: newPortValue = HyperionServer.BuildUsingDefaultFbsSettings().Port; break; case HyperionServerProtocol.PROTOCOL_BUFFERS: newPortValue = HyperionServer.BuildUsingDefaultProtoSettings().Port; break; default: throw new NotImplementedException($"Hyperion server protocol {serverProtocol} is not supported yet"); } dgHyperionAddress.Rows[e.RowIndex].Cells["clmnPort"].Value = newPortValue; // Change port according to protocol } } }
public ServerPropertiesForm(HyperionTaskConfiguration taskConfiguration) { this._defaultServerConfiguration = HyperionServer.BuildUsingDefaultFbsSettings(); this.TaskConfiguration = taskConfiguration; InitializeComponent(); this.Text = $"{this.Text} - {taskConfiguration.Id}"; var protocolColumn = (DataGridViewComboBoxColumn)this.dgHyperionAddress.Columns.GetFirstColumn(DataGridViewElementStates.Visible); protocolColumn.DataSource = Enum.GetValues(typeof(HyperionServerProtocol)); protocolColumn.ValueType = typeof(HyperionServerProtocol); InitFormFields(); }