Пример #1
0
        public SlaveDevice AddSlaveDevice(byte id)
        {
            var slave = new SlaveDevice(id, this);

            SlaveDevices.Add(slave);
            return(slave);
        }
Пример #2
0
        private void UpdateDevicesCollection(IEnumerable <Device> newDevices)
        {
            if (newDevices != null && newDevices.Any())
            {
                var toBeAdds = newDevices.Except(_slaveDevices, new DeviceEqualityComparer <Device>());

                if (toBeAdds.Any())
                {
                    DispatcherHelper.UIDispatcher.Invoke(() =>
                    {
                        foreach (var device in toBeAdds)
                        {
                            SlaveDevices.Add(device);
                        }
                    });
                }
            }
        }