private void toolStripButton_Edit_Click(object sender, EventArgs e) { if (simulator_DataGridView.SelectedRows.Count == 1) { DeviceSimulator simulator = simulator_DataGridView.SelectedRows[0].DataBoundItem as DeviceSimulator; //Display the Simulator for editing. using (SimulatorEditForm form = new SimulatorEditForm(simulator.AssetId)) { DialogResult result = form.ShowDialog(); if (result == DialogResult.OK) { RefreshData(); } } } }
private void toolStripButton_New_Click(object sender, EventArgs e) { //Create a new Simulator DeviceSimulator simulator = new DeviceSimulator() { AssetId = string.Empty, AssetType = "DeviceSimulator", Capability = 0, //Default to no capabilities selected Address = string.Empty, VirtualMachine = string.Empty, FirmwareVersion = string.Empty, SimulatorType = string.Empty }; //Display the new Simulator for editing. using (SimulatorEditForm form = new SimulatorEditForm(simulator)) { DialogResult result = form.ShowDialog(); if (result == DialogResult.OK) { RefreshData(); } } }