Beispiel #1
0
 private void RemoveDeviceAction(RemoveDeviceMessage action)
 {
     // Default value is 0, if this device is in the database then it will have been changed
     if (action.Device.Info.id >= 0)
     {
         action.Device.Info.deleted = true;
         DevicesToBeRemoved.Add(action.Device);
     }
     if (action.Device != null)
     {
         Devices.Remove(action.Device);
     }
 }
Beispiel #2
0
        private void UpdateDevices()
        {
            foreach (var dm in DevicesToBeRemoved)
            {
                Devices.Add(dm);
            }

            foreach (var dm in Devices)
            {
                dm.Control.DoDataBinding();
                var di = model.devices.Find(d => d.Equals(dm.Info));
                if (di != null)
                {
                    di.collectors = dm.Info.collectors;
                    di.ipAddress  = dm.Info.ipAddress;
                }
                else
                {
                    model.devices.Add(dm.Info);
                }
            }

            DevicesToBeRemoved.Clear();
        }