Example #1
0
        private static void Instance_DeviceGetInfo(object sender, DeviceGetInfoEventArgs e)
        {
            var t = Thread.CurrentThread.ManagedThreadId;

            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                var mainWindow = (MainWindow)Application.Current.MainWindow;
                mainWindow.ListBoxTest.Items.Add("Device info: " + e.Info + " : thread - " + t);
            }));
        }
Example #2
0
 public string GetInfo(string serialNumber)
 {
     lock (lockObj)
     {
         var device = devices.Where(r => r?.SerialNumber == serialNumber).FirstOrDefault();
         DeviceGetInfoEventArgs e = new DeviceGetInfoEventArgs()
         {
             Info = device?.GetInfo, Device = device
         };
         OnDeviceGetInfo(e);
         return(device?.GetInfo);
     }
 }
Example #3
0
 protected virtual void OnDeviceGetInfo(DeviceGetInfoEventArgs e)
 {
     DeviceGetInfo?.Invoke(this, e);
 }