Beispiel #1
0
        private void AddDevice(ButtplugClientDevice device)
        {
            var newDevice = new ButtplugDevice(device, this);

            _devices.Add(newDevice);
            OnDeviceFound(newDevice);
        }
Beispiel #2
0
        private void RemoveDevice(ButtplugDevice device)
        {
            if (device == null)
            {
                return;
            }

            _devices.Remove(device);
            OnDeviceRemoved(device);
        }
Beispiel #3
0
        private void RemoveDevice(ButtplugDevice device)
        {
            if (device == null)
            {
                return;
            }

            if (_devices.TryRemove(device.Index, out var old))
            {
                OnDeviceRemoved(old);
            }
        }
Beispiel #4
0
        private void AddDevice(ButtplugClientDevice device)
        {
            var newDevice = new ButtplugDevice(device, this);

            _devices.AddOrUpdate(newDevice.Index,
                                 (newIdx) =>
            {
                OnDeviceFound(newDevice);
                return(newDevice);
            },
                                 (updateIdx, oldDev) =>
            {
                OnDeviceRemoved(oldDev);
                OnDeviceFound(newDevice);
                return(newDevice);
            });
        }
Beispiel #5
0
        private void RemoveDevice(ButtplugClientDevice device)
        {
            ButtplugDevice localDevice = _devices.SingleOrDefault(dev => dev.Index == device.Index);

            RemoveDevice(localDevice);
        }