Esempio n. 1
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();
		}
Esempio n. 2
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();
			}
		}
Esempio n. 3
0
		public static void EditZone(XZone zone)
		{
			foreach (var device in zone.Devices)
			{
				device.OnChanged();
			}
			foreach (var device in zone.DevicesInLogic)
			{
				device.OnChanged();
			}
			foreach (var direction in zone.Directions)
			{
				direction.OnChanged();
			}
			zone.OnChanged();
		}
Esempio n. 4
0
		public static void RemoveZone(XZone zone)
		{
			foreach (var device in zone.Devices)
			{
				device.Zones.Remove(zone);
				device.ZoneUIDs.Remove(zone.UID);
				device.OnChanged();
			}
			foreach (var direction in zone.Directions)
			{
				direction.InputZones.Remove(zone);
                var directionZone = direction.DirectionZones.FirstOrDefault(x => x.Zone == zone);
                if (directionZone != null)
                {
                    direction.DirectionZones.Remove(directionZone);
                    direction.InputZones.Remove(zone);
                }
				direction.OnChanged();
			}
			Zones.Remove(zone);
			zone.OnChanged();
		}