Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
		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);
			}
		}
Ejemplo n.º 3
0
 void OnRemove(DirectionDeviceViewModel directionDeviceViewModel)
 {
     DirectionDevices.Remove(directionDeviceViewModel);
 }
Ejemplo n.º 4
0
 void OnAdd()
 {
     var directionDeviceViewModel = new DirectionDeviceViewModel();
     DirectionDevices.Add(directionDeviceViewModel);
 }