public DirectionDevicesViewModel(XDirection direction)
        {
            AddCommand = new RelayCommand(OnAdd);
            RemoveCommand = new RelayCommand<DirectionDeviceViewModel>(OnRemove);

            Direction = direction;

            DirectionDevices = new ObservableCollection<DirectionDeviceViewModel>();
            if (direction.DirectionDevices == null)
                direction.DirectionDevices = new List<DirectionDevice>();
            foreach (var directionDevice in direction.DirectionDevices)
            {
                var directionDeviceViewModel = new DirectionDeviceViewModel(directionDevice);
                DirectionDevices.Add(directionDeviceViewModel);
            }
        }
		public void InitializeDependences()
		{
			Zones.Clear();
			foreach (var directionZone in Direction.DirectionZones)
			{
				var directionZoneViewModel = new DirectionZoneViewModel(directionZone);
				Zones.Add(directionZoneViewModel);
			}

			Devices.Clear();
			foreach (var directionDevice in Direction.DirectionDevices)
			{
				var directionDeviceViewModel = new DirectionDeviceViewModel(directionDevice);
				Devices.Add(directionDeviceViewModel);
			}

			OutputDevices.Clear();
			foreach (var outputDevice in Direction.OutputDevices)
			{
				var deviceViewModel = new DeviceViewModel(outputDevice);
				OutputDevices.Add(deviceViewModel);
			}
		}
 void OnRemove(DirectionDeviceViewModel directionDeviceViewModel)
 {
     DirectionDevices.Remove(directionDeviceViewModel);
 }
 void OnAdd()
 {
     var directionDeviceViewModel = new DirectionDeviceViewModel();
     DirectionDevices.Add(directionDeviceViewModel);
 }