Example #1
0
        private void OnDeviceSeen(object sender, AtemDeviceInfo info)
        {
            var id = info.Id();

            lock (_devices)
            {
                if (_devices.TryGetValue(id, out AtemDevice device))
                {
                    device.Info = info;

                    // If remembered, sync changes to the db
                    if (device.Remember)
                    {
                        _dbDevices.Update(id, device);
                    }
                }
                else
                {
                    _devices[id] = new AtemDevice(info);
                    Log.InfoFormat("Discovered device: {0}", info.ToString());
                }

                SendDevicesDebounce();
            }
        }
Example #2
0
        private void OnDeviceLost(object sender, AtemDeviceInfo info)
        {
            var id = info.Id();

            lock (_devices)
            {
                if (_devices.TryGetValue(id, out AtemDevice device))
                {
                    Log.InfoFormat("Lost device: {0}", info.ToString());

                    if (!device.Remember)
                    {
                        _devices.Remove(id);

                        _dbDevices.Delete(id); // Ensure its not in the db (it shouldnt be)
                    }

                    // Ensure device is in expected state
                    SetupConnection(device);

                    SendDevicesDebounce();
                }
            }
        }