public DeviceDetailsViewModel(GKDevice device) { ShowCommand = new RelayCommand(OnShow); ShowParentCommand = new RelayCommand(OnShowParent, CanShowParent); ShowZoneCommand = new RelayCommand(OnShowZone); ShowJournalCommand = new RelayCommand(OnShowJournal); Device = device; DeviceStateViewModel = new DeviceStateViewModel(State, device.Driver.IsAm); State.StateChanged += OnStateChanged; State.MeasureParametersChanged += OnMeasureParametersChanged; DeviceCommandsViewModel = new DeviceCommandsViewModel(Device); DevicePropertiesViewModel = new DevicePropertiesViewModel(Device); PlanLinks = new PlanLinksViewModel(Device); Title = Device.PresentationName; StartMeasureParametersMonitoring(); ServiceFactory.Events.GetEvent<GKObjectsPropertyChangedEvent>().Unsubscribe(OnGKObjectsPropertyChanged); ServiceFactory.Events.GetEvent<GKObjectsPropertyChangedEvent>().Subscribe(OnGKObjectsPropertyChanged); }
public DeviceDetailsViewModel(XDevice device) { ShowCommand = new RelayCommand(OnShow); ShowParentCommand = new RelayCommand(OnShowParent, CanShowParent); ShowOnPlanCommand = new RelayCommand<Plan>(OnShowOnPlan); ShowZoneCommand = new RelayCommand(OnShowZone); ShowJournalCommand = new RelayCommand(OnShowJournal); Device = device; DeviceStateViewModel = new DeviceStateViewModel(State); State.StateChanged += new Action(OnStateChanged); State.MeasureParametersChanged += new Action(OnMeasureParametersChanged); DeviceCommandsViewModel = new DeviceCommandsViewModel(Device); DevicePropertiesViewModel = new DevicePropertiesViewModel(Device); InitializePlans(); Title = Device.PresentationName; TopMost = true; StartMeasureParametersMonitoring(); }