Пример #1
0
		public static void AddDeviceToZone(GKDevice device, GKZone zone)
		{
			if (!device.Zones.Contains(zone))
			{
				device.Zones.Add(zone);
			}
			if (!device.ZoneUIDs.Contains(zone.UID))
				device.ZoneUIDs.Add(zone.UID);
			if (!device.InputDependentElements.Contains(zone))
				device.InputDependentElements.Add(zone);
			if (!zone.OutputDependentElements.Contains(device))
				zone.OutputDependentElements.Add(device);
			zone.Devices.Add(device);
			zone.OnChanged();
			device.OnChanged();
		}
Пример #2
0
		/// <summary>
		/// Удаление зоны
		/// </summary>
		/// <param name="zone"></param>
		public static void RemoveZone(GKZone zone)
		{
			Zones.Remove(zone);
			zone.OutputDependentElements.ForEach(x =>
			{
				x.InputDependentElements.Remove(zone);
				if (x is GKDevice)
				{
					x.Invalidate(DeviceConfiguration);
					x.OnChanged();
				}
				x.UpdateLogic(DeviceConfiguration);
				x.OnChanged();
			});

			foreach (var device in zone.Devices)
			{
				device.Zones.Remove(zone);
				device.ZoneUIDs.Remove(zone.UID);
				device.OnChanged();
			}

			zone.OnChanged();
		}
Пример #3
0
		/// <summary>
		/// Редактирование зоны
		/// </summary>
		/// <param name="zone"></param>
		public static void EditZone(GKZone zone)
		{
			zone.OnChanged();
			zone.OutputDependentElements.ForEach(x => x.OnChanged());
		}
Пример #4
0
		public static void RemoveDeviceFromZone(GKDevice device, GKZone zone)
		{
			if (zone != null)
			{
				device.Zones.Remove(zone);
				device.ZoneUIDs.Remove(zone.UID);
				zone.Devices.Remove(device);
				zone.OutputDependentElements.Remove(device);
				device.InputDependentElements.Remove(zone);
				zone.OnChanged();
				device.OnChanged();
			}
		}