/// <summary> /// The on threshold read. /// </summary> /// <param name="args"> /// The args. /// </param> internal void OnThresholdRead(HidDataReceivedEvenArgs args) { var handler = this.HookHidDevice; if (handler != null) { handler(this, args); } }
private void OnHookHidDevice(object sender, HidDataReceivedEvenArgs e) { ThreadPool.QueueUserWorkItem(callback => Deployment.Current.Dispatcher.BeginInvoke( () => { if (InitParams.IsDebugSnifferBarCode) WriteLog("Receiving data from hid device"); foreach (var item in _collectionOfInstance.Where(x => x.Value.Contains("Vid") && x.Value.Contains("Pid"))) { if (InitParams.IsDebugSnifferBarCode) WriteLog("Receiving from:>>>" + GetHidName(e.DeviceInfo.VendorId, e.DeviceInfo.ProductId, e.DeviceInfo.ParentIdPrefix)); if (GetHidName(e.DeviceInfo.VendorId, e.DeviceInfo.ProductId, e.DeviceInfo.ParentIdPrefix) != item.Value) continue; if (InitParams.IsDebugSnifferBarCode) WriteLog("Call Instance:>>>ProcessName:" + ProcessName + ">>>ExpressionVariable:" + item.Key + CalculatedVariable + ">>>DeviceInfoKey:" + e.DeviceInfo.Key); var value = ClearInputString(e.DeviceInfo.Key); if (InitParams.IsDebugSnifferBarCode) WriteLog("Cleared Input String from:>>>" + GetHidName(e.DeviceInfo.VendorId, e.DeviceInfo.ProductId, e.DeviceInfo.ParentIdPrefix) + ">>" + value); var instance = this.InstanceDataVariable(ProcessName, item.Key + CalculatedVariable, value); var methodInfo = instance.GetType().GetMethod(CalculateSecondExpression); if (methodInfo != null) { methodInfo.Invoke(instance, new object[] { EditableRoot }); } } })); }