예제 #1
0
        private async void OnDeviceDetected(object sender, ScannerDeviceStatusChangedEventArgs e)
        {
            var device = e.Device;

            if (device is EposDevice eposDevice)
            {
                AddDevice(device);

                RegisterDeviceEvents(eposDevice);

                MsgLogger.WriteDebug($"{GetType().Name} - method", $"try to connect to device {eposDevice.Family}");

                if (!await ConnectDevice(eposDevice))
                {
                    MsgLogger.WriteError($"{GetType().Name} - OnDeviceDetected", $"connect to device {eposDevice.Family} failed!");

                    UnregisterDeviceEvents(eposDevice);
                }
                else
                {
                    MsgLogger.WriteDebug($"{GetType().Name} - method", $"connect to device {eposDevice.Family} successful");
                }
            }
            else
            {
                MsgLogger.WriteLine($"device: {device.Family} not supported!");
            }
        }
예제 #2
0
 protected virtual void OnDeviceDetected(ScannerDeviceStatusChangedEventArgs e)
 {
     DeviceDetected?.Invoke(this, e);
 }