public Avtor(NSI x, Smena y, ScannerAll.BarcodeScanner xSc, AppPars xp) { InitializeComponent(); xNSI = x; xSm = y; xBCS = xSc; //nTerminalType = xSc.nTermType; xPars = xp; //bMayQuit = false; }
public static bool HandleSpecMode(KeyEventArgs e, bool bEdit, ScannerAll.BarcodeScanner xSc, bool ArrWSft) { bool ret = false; if (ArrWSft == true) {// стрелки работают только с Shift if (e.Shift == true) { #if SYMBOL if ((null != xSc) && (xSc.nTermType == ScannerAll.TERM_TYPE.SYMBOL) && (xSc.nKeys == 48)) { byte newKey = IsArrow(e); if (newKey > 0) { // это возможная стрелка if (bEdit == true) { // теперь будет стрелка if (e.Handled != true) { //int sc = GetKeyState(W32.VK_CONTROL); //int ss = GetKeyState(W32.VK_SHIFT); ((ScannerAll.Symbol.SymbolBarcodeScanner)xSc).SetShiftOff(); TimeSpan tsDiff; int nMSec = 0, t1 = Environment.TickCount; while (nMSec < 300) { tsDiff = new TimeSpan(0, 0, 0, 0, Environment.TickCount - t1); nMSec = tsDiff.Milliseconds; } //ss = GetKeyState(W32.VK_SHIFT); //sc = GetKeyState(W32.VK_CONTROL); //W32.keybd_event(W32.VK_UP, W32.VK_UP, W32.KEYEVENTF_SILENT, 0); //W32.keybd_event(W32.VK_UP, W32.VK_UP, W32.KEYEVENTF_KEYUP | W32.KEYEVENTF_SILENT, 0); //W32.keybd_event(newKey, newKey, W32.KEYEVENTF_SILENT, 0); //W32.keybd_event(newKey, newKey, W32.KEYEVENTF_KEYUP | W32.KEYEVENTF_SILENT, 0); W32.keybd_event(newKey, 0, W32.KEYEVENTF_SILENT, 0); W32.keybd_event(newKey, 0, W32.KEYEVENTF_KEYUP | W32.KEYEVENTF_SILENT, 0); e.Handled = true; } ret = true; } } } #endif } } return(ret); }
/// <summary> /// Creates and returns a generic (device independent) barcode scanner object. /// </summary> /// <returns>Generic barcode scanner object</returns> public static BarcodeScanner GetBarcodeScanner(System.Windows.Forms.Control ctlInvoker) { BarcodeScannerFactory BarcodeScannerFactory = null; BarcodeScanner BarcodeScanner = null; string sOEM = new string(' ', 50); int result = SystemParametersInfo(SPI_GETOEMINFO, 50, sOEM, 0); if (result != 0) { sOEM = sOEM.Substring(0, sOEM.IndexOf('\0')).ToUpper(); } // Is this a Symbol device? if ((sOEM.IndexOf("SYMBOL") > -1) || (sOEM.IndexOf("MOTOROLA") > -1)) { #if SYMBOL BarcodeScannerFactory = new Symbol.SymbolBarcodeScannerFactory(); #endif } else if (sOEM.IndexOf("HAND HELD") > -1) { #if DOLPH7850 BarcodeScannerFactory = new Dolphin.DolphinBarcodeScannerFactory(); #endif } else if (sOEM.IndexOf("HONEYWELL") > -1) { #if DOLPH9950 BarcodeScannerFactory = new Honeywell.HoneyBarcodeScannerFactory(); #elif HWELL6100 BarcodeScannerFactory = new Honeywell.HWell6100Factory(); #endif } else if (sOEM.IndexOf("DATALOGIC") > -1) { #if DATALOGIC BarcodeScannerFactory = new DL.DLBarcodeScannerFactory(ctlInvoker); #endif } else if (sOEM.IndexOf("HX2") > -1) { #if HWELLHX2 BarcodeScannerFactory = new Honeywell.HWellHX2Fact(); #endif } else if (sOEM.IndexOf("NORDIC") > -1) { #if NRDMERLIN BarcodeScannerFactory = new Nordic.NordicMerlinFactory((sOEM.IndexOf("MORPHIC") > -1)?TERM_TYPE.NRDMORPHIC:TERM_TYPE.NRDMERLIN); #endif } else { #if PSC BarcodeScannerFactory = new PSC.PSCBarcodeScannerFactory(ctlInvoker); #endif } // Конкретная модель определена if (BarcodeScannerFactory == null) { BarcodeScannerFactory = new UnknownBarcodeScannerFactory(); } BarcodeScanner = BarcodeScannerFactory.GetBarcodeScanner(sOEM); BarcodeScanner.BCInvoker = ctlInvoker; return(BarcodeScanner); }