Пример #1
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();
        }
Пример #2
0
        public void OnChanged(OmDeviceEventArgs e)
        {
            if (e.DownloadStatus == OmApi.OM_DOWNLOAD_STATUS.OM_DOWNLOAD_COMPLETE)
            {
                e.Device.FinishedDownloading();
            }

            if (DeviceChanged != null)
            {
                DeviceChanged(this, e);
            }
        }
Пример #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();
        }
Пример #4
0
 void Instance_DeviceRemoved(object sender, OmApiNet.OmDeviceEventArgs e)
 {
     this.BeginInvoke(new Om.OmDeviceEventHandler(RemoveDevice), new object[] { sender, e });
 }