コード例 #1
0
        private void dgvMachine_SelectionChanged(object sender, EventArgs e)
        {
            if (dgvMachine.SelectedCells.Count > 0 && dgvMachine.SelectedCells[0].RowIndex >= 0)
            {
                var rowIndex = dgvMachine.SelectedCells[0].RowIndex;
                var row = dgvMachine.Rows[rowIndex];
                var machineId = int.Parse(row.Cells["ID"].Value.ToString());
                _selectedMachine = _machineService.GetMachineById(machineId);
                var name = row.Cells["Name"].Value.ToString();
                var machineGroup = _machineService.GetMachineGroupByMachineName(name);

                txtMachineName.Text = name;
                cbMachineGroup.Text = (machineGroup != null) ? machineGroup.Name : "";
            }
        }
コード例 #2
0
 private void ResetForm()
 {
     txtMachineName.Text = "";
     cbMachineGroup.SelectedIndex = -1;
     _selectedMachine = null;
     dgvMachine.ClearSelection();
     dgvMachine.CurrentCell = null;
     dgvMachineGroup.ClearSelection();
     dgvMachineGroup.CurrentCell = null;
 }