Пример #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);
            }
        }
Пример #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);
			}
		}
Пример #3
0
 void OnRemove(DirectionDeviceViewModel directionDeviceViewModel)
 {
     DirectionDevices.Remove(directionDeviceViewModel);
 }
Пример #4
0
 void OnAdd()
 {
     var directionDeviceViewModel = new DirectionDeviceViewModel();
     DirectionDevices.Add(directionDeviceViewModel);
 }