public void DeleteZone(XDirectionZone directionZone)
		{
			List<XDirectionZone> directionZones = Direction.DirectionZones;
			directionZones.Remove(directionZone);
			var zones = new List<XZone>();
			directionZones.ForEach(x => zones.Add(x.Zone));
			XManager.ChangeDirectionZones(Direction, zones);
			InitializeDependences();
			ServiceFactory.SaveService.GKChanged = true;
		}
Beispiel #2
0
		public static void ChangeDirectionZones(XDirection direction, List<XZone> zones)
		{
			foreach (var zone in direction.InputZones)
			{
				zone.Directions.Remove(direction);
				zone.OnChanged();
			}
			direction.InputZones.Clear();
            var oldDirectionZones = new List<XDirectionZone>(direction.DirectionZones);
            direction.DirectionZones.Clear();
            foreach (var zone in zones)
            {
                direction.InputZones.Add(zone);
                var directionZone = new XDirectionZone()
                {
                    ZoneUID = zone.UID,
                    Zone = zone
                };
                var existingDirectionZone = oldDirectionZones.FirstOrDefault(x => x.Zone == zone);
                if (existingDirectionZone != null)
                {
                    directionZone.StateBit = existingDirectionZone.StateBit;
                }
                direction.DirectionZones.Add(directionZone);
                zone.Directions.Add(direction);
                zone.OnChanged();
            }
			direction.OnChanged();
		}
 public DirectionZoneViewModel(XDirectionZone directionZone)
 {
     DirectionZone = directionZone;
 }