예제 #1
0
		public static void RemoveDevice(XDevice device)
		{
			var parentDevice = device.Parent;
			foreach (var zone in device.Zones)
			{
				zone.Devices.Remove(device);
				zone.OnChanged();
			}
			foreach (var direction in device.Directions)
			{
				direction.InputDevices.Remove(device);
				direction.OutputDevices.Remove(device);
				var directionDevice = direction.DirectionDevices.FirstOrDefault(x => x.Device == device);
				if (directionDevice != null)
				{
					direction.DirectionDevices.Remove(directionDevice);
					direction.InputDevices.Remove(device);
				}

				direction.OnChanged();
			}
			parentDevice.Children.Remove(device);
			Devices.Remove(device);

			if (parentDevice.DriverType == XDriverType.RSR2_KAU_Shleif)
				RebuildRSR2Addresses(parentDevice.Parent);
			device.OnChanged();
		}
예제 #2
0
		public static void AddDeviceToZone(XDevice device, XZone zone)
		{
			if (!device.Zones.Contains(zone))
				device.Zones.Add(zone);
			if (!device.ZoneUIDs.Contains(zone.UID))
				device.ZoneUIDs.Add(zone.UID);
			zone.Devices.Add(device);
			zone.OnChanged();
			device.OnChanged();
		}
예제 #3
0
		public static void RemoveDeviceFromZone(XDevice device, XZone zone)
		{
			if (zone != null)
			{
				device.Zones.Remove(zone);
				device.ZoneUIDs.Remove(zone.UID);
				zone.Devices.Remove(device);
				zone.OnChanged();
				device.OnChanged();
			}
		}
예제 #4
0
 public static void ChangeDeviceZones(XDevice device, List<XZone> zones)
 {
     foreach (var zone in device.Zones)
     {
         zone.Devices.Remove(device);
         zone.OnChanged();
     }
     device.Zones.Clear();
     device.ZoneUIDs.Clear();
     foreach (var zone in zones)
     {
         device.Zones.Add(zone);
         device.ZoneUIDs.Add(zone.UID);
         zone.Devices.Add(device);
         zone.OnChanged();
     }
     device.OnChanged();
 }
예제 #5
0
		public static void ChangeDeviceLogic(XDevice device, XDeviceLogic deviceLogic)
		{
			foreach (var clause in device.DeviceLogic.Clauses)
			{
				foreach (var direction in clause.Directions)
				{
					direction.OutputDevices.Remove(device);
					direction.OnChanged();
					device.Directions.Remove(direction);
				}
			}
			device.DeviceLogic = deviceLogic;
			UpdateConfigurationHelper.InvalidateOneLogic(DeviceConfiguration, device, device.DeviceLogic);
			device.OnChanged();
		}