| | |
| | | this.KeyPreview = true; |
| | | this.KeyPress += MainForm_KeyPress; |
| | | |
| | | Trace.TraceInformation("键盘事件已加载"); |
| | | |
| | | hcXyView.Focus(); |
| | | } |
| | | |
| | |
| | | CarrierBarcodeCtrl cBarcodeCtrl = null; |
| | | private void MainForm_KeyPress(object sender, KeyPressEventArgs e) |
| | | { |
| | | if (e.KeyChar == 27) |
| | | try |
| | | { |
| | | hcXyView.Focus(); |
| | | } |
| | | else |
| | | { |
| | | if (allowBarcodeFlag) |
| | | if (e.KeyChar == 27) |
| | | { |
| | | cBarcodeCtrl.AddChar(e.KeyChar); |
| | | hcXyView.Focus(); |
| | | } |
| | | else |
| | | { |
| | | if (allowBarcodeFlag) |
| | | { |
| | | Trace.TraceInformation($"键盘输入:{e.KeyChar}"); |
| | | cBarcodeCtrl.AddChar(e.KeyChar); |
| | | } |
| | | else |
| | | { |
| | | Trace.TraceInformation($"当前不允许按键输入:{e.KeyChar}"); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Trace.TraceError($"键盘事件异常:{ex.Message}"); |
| | | } |
| | | } |
| | | #endregion |
| | |
| | | if ((bool)item.value) |
| | | { |
| | | //opc.Write(OPCInputTag.UnloadTrayReady, false); |
| | | |
| | | allowBarcodeFlag = false; |
| | | } |
| | | break; |