/// <summary> /// Stores references to dependencies and listens for incoming messages. /// </summary> /// <param name="comm">The mediator which allows communication between view models.</param> /// <param name="svc">The bug tracker web service.</param> /// <param name="activeProj"></param> public CommandPanelViewModel(IMessenger comm, ITrackerService svc, ProjectViewModel activeProj) { if (comm == null) { throw new ArgumentNullException("The messenger cannot be null."); } if (svc == null) { throw new ArgumentNullException("Web service cannot be null."); } _Messenger = comm; _Service = svc; if (!IsProjectNull(activeProj)) { _ActiveProject = activeProj; } ListenForMessages(); }
/// <summary> /// Stores references to dependencies and sets up a message listener. /// </summary> /// <param name="comm">The communication channel with other view models.</param> /// <param name="svc">The bug tracker web service.</param> /// <param name="activeProj">The currently active project.</param> public BugPanelViewModel(IMessenger comm, ITrackerService svc, ProjectViewModel activeProj) { if (comm == null) { throw new ArgumentNullException("The messenger cannot be null."); } if (activeProj == null) { throw new ArgumentNullException("The active project cannot be null."); } if (svc == null) { throw new ArgumentNullException("The web service cannot be null."); } _Messenger = comm; _Service = svc; _ActiveProject = activeProj; ListenForMessages(); }
private bool ActiveProjectUpdated(ProjectViewModel project) { return(SelectedActiveProject.Id == project.Id && ProjectComboBox.Count > 1); }
/// <summary> /// Subscribes to incoming messages concerned with data in this object. /// </summary> private void ListenForMessages() { _Messenger.Register <BugViewModel>(Messages.SelectedBugChanged, p => _SelectedBug = p); _Messenger.Register <ProjectViewModel>(Messages.ActiveProjectChanged, p => _ActiveProject = p); _Messenger.Register <bool>(Messages.BugTableDisplaying, p => _IsBugTableDisplaying = p); }