Ejemplo n.º 1
0
		public void OnAdd()
		{
			var mptDeviceSelectationViewModel = new MPTDeviceSelectationViewModel();
			if (ServiceFactory.DialogService.ShowModalWindow(mptDeviceSelectationViewModel))
			{
				var mptDevice = mptDeviceSelectationViewModel.MptDevice;
				SelectedDevice = new MPTDeviceViewModel(mptDevice);
				MPT.MPTDevices.Add(mptDevice);
				UpdateMptDevice(mptDevice);
			}
		}
Ejemplo n.º 2
0
		public MPTViewModel(GKMPT mpt)
		{
			MPT = mpt;
			ChangeStartLogicCommand = new RelayCommand(OnChangeStartLogic);
			ChangeStopLogicCommand = new RelayCommand(OnChangeStopLogic);
			ChangeSuspendLogicCommand = new RelayCommand(OnChangeSuspendLogic);
			AddCommand = new RelayCommand(OnAdd);
			EditCommand = new RelayCommand(OnEdit, () => SelectedDevice != null);
			DeleteCommand = new RelayCommand(OnDelete, () => SelectedDevice != null);
			EditPropertiesCommand = new RelayCommand(OnEditProperties, CanEditProperties);

			MPT.Changed += Update;
			MPT.PlanElementUIDsChanged += UpdateVisualizationState;
			Devices = new ObservableCollection<MPTDeviceViewModel>();
			foreach (var mptDevice in MPT.MPTDevices)
			{
				var deviceViewModel = new MPTDeviceViewModel(mptDevice);
				Devices.Add(deviceViewModel);
			}
			Update();
		}
Ejemplo n.º 3
0
		public void Update()
		{
			UpdateVisualizationState();
			var oldSelectedDeviceUID = SelectedDevice != null ? SelectedDevice.MPTDevice.DeviceUID : Guid.NewGuid();
			Devices = new ObservableCollection<MPTDeviceViewModel>();
			foreach (var mptDevice in MPT.MPTDevices)
			{
				var deviceViewModel = new MPTDeviceViewModel(mptDevice);
				Devices.Add(deviceViewModel);
			}
			SelectedDevice = Devices.FirstOrDefault(x => x.MPTDevice.DeviceUID == oldSelectedDeviceUID) ?? Devices.FirstOrDefault();
			OnPropertyChanged(() => MPT);
			OnPropertyChanged(() => Devices);
			OnPropertyChanged(() => StartPresentationName);
			OnPropertyChanged(() => StopPresentationName);
			OnPropertyChanged(() => SuspendPresentationName);
		}