//添加设备 private void button16_Click(object sender, EventArgs e) { MsgDeviceSetting theMsgDeviceSetting = new MsgDeviceSetting(); theMsgDeviceSetting.Text = "添加设备"; theMsgDeviceSetting.isAddOrUpdate = 0; theMsgDeviceSetting.ShowDialog(); }
//修改设备 private void button15_Click(object sender, EventArgs e) { if (DeviceDataView.SelectedRows.Count > 0 && ValidateData.CellIsNullOrZero(DeviceDataView.SelectedRows[0].Cells["DeviceDataID"])) { DeviceDataSetting theDeviceDataSetting = new DeviceDataSetting(); theDeviceDataSetting.DeviceDataName = DeviceDataView.SelectedRows[0].Cells["DeviceDataName"].Value.ToString(); theDeviceDataSetting.DeviceDataID = DeviceDataView.SelectedRows[0].Cells["DeviceDataID"].Value.ToString(); theDeviceDataSetting.RemoteAToID = DeviceDataView.SelectedRows[0].Cells["RemoteAToID"].Value.ToString(); theDeviceDataSetting.RemoteBToID = DeviceDataView.SelectedRows[0].Cells["RemoteBToID"].Value.ToString(); theDeviceDataSetting.RemoteCToID = DeviceDataView.SelectedRows[0].Cells["RemoteCToID"].Value.ToString(); theDeviceDataSetting.DeviceDataToID = DeviceDataView.SelectedRows[0].Cells["DeviceDataToID"].Value.ToString(); MsgDeviceSetting theMsgDeviceSetting = new MsgDeviceSetting(theDeviceDataSetting); theMsgDeviceSetting.Text = "修改设备"; theMsgDeviceSetting.isAddOrUpdate = 1; theMsgDeviceSetting.ShowDialog(); } else { HandelControls.Msg("请选择要修改的数据", MessageBoxButtons.OK, MessageBoxIcon.Error); } }