示例#1
0
 void Instance_DeviceRemoved(object sender, OmApiNet.OmDeviceEventArgs e)
 {
     this.BeginInvoke(new Om.OmDeviceEventHandler(RemoveDevice), new object[] { sender, e });
 }
示例#2
0
 private void RemoveDevice(object sender, OmApiNet.OmDeviceEventArgs e)
 {
     int id = e.Device.DeviceId;
     if (devices.ContainsKey(id))
     {
         // Always remove device
         devices.Remove(id);
     }
     UpdateDevices();
 }
示例#3
0
        private void AddDevice(object sender, OmApiNet.OmDeviceEventArgs e)
        {
            int id = e.Device.DeviceId;
            DeviceStatus device;

            if (!devices.ContainsKey(id))
            {
                devices[id] = new DeviceStatus(id);
            }
            device = devices[id];

            if (device.Connected)
            {
                Console.WriteLine("WARNING: Device ID " + id + " already connected!");
                return;
            }

            device.Connected = true;

            UpdateDevices();
        }