private void bgsjTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 13) { string res = Changed(CommandType.Exposure, bgsjTextBox.Text); if (res.Equals("1")) { bgsjLabel.Text = monitorView.Get(CommandType.Exposure); } } }
void Changed(CommandType type, string value, Label showLabel) { isChanged = true; if (monitorView.Data == null) { MessageBox.Show("相机未连接!或当前连接的相机ip不在当前选择的物料编号之中"); showLabel.Text = "未连接"; } monitorView.Data.SetValue(type, value); string res = ""; if (type == CommandType.MatNo || type == CommandType.BarCode) { res = monitorView.SetWithString(type, value); } else { res = monitorView.Set(type, value); } if (res.Equals("1")) { showLabel.Text = monitorView.Get(type); } }