public LinkedDeckTraversalModel(EventQueue dispatcher, Guid id, PresenterModel model, DeckTraversalModel linked) : base(id, linked.Deck) { this.m_EventQueue = dispatcher; this.m_Model = model; this.m_Linked = linked; // TODO: Evaluate whether we need to support other types of DeckTraversalModels. this.m_Unlinked = new SlideDeckTraversalModel(Guid.NewGuid(), linked.Deck); this.m_CurrentChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleCurrentChanged)); this.m_NextChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleNextChanged)); this.m_PreviousChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandlePreviousChanged)); this.m_AbsoluteCurrentSlideIndexChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleAbsoluteCurrentSlideIndexChanged)); // Set this.m_Active and register event listeners via UpdateMode. this.m_Mode = DeckTraversalSelector.Linked; this.UpdateMode(DeckTraversalSelector.Linked); // Since UpdateMode doesn't initialize the event listeners like the Mode setter does, we must do this. this.m_CurrentChangedDispatcher.Dispatcher(this, null); this.m_NextChangedDispatcher.Dispatcher(this, null); this.m_PreviousChangedDispatcher.Dispatcher(this, null); this.m_AbsoluteCurrentSlideIndexChangedDispatcher.Dispatcher(this, null); // Watch for changes to the current network association. // When we're associated with an Instructor, we must obey its ForcingStudentNavigationLock policy. this.m_NetworkAssociationChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleNetworkAssociationChanged)); this.m_NetworkAssociationRoleChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleNetworkAssociationRoleChanged)); this.m_ForcingStudentNavigationLockChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleForcingStudentNavigationLockChanged)); this.m_Model.Network.Changed["Association"].Add(this.m_NetworkAssociationChangedDispatcher.Dispatcher); this.m_NetworkAssociationChangedDispatcher.Dispatcher(this, null); }
private void UpdateMode(DeckTraversalSelector value) { if (this.m_Active != null) { this.UnregisterActiveEventListeners(); } switch (value) { case DeckTraversalSelector.Linked: this.m_Active = this.m_Linked; break; case DeckTraversalSelector.Unlinked: this.m_Active = this.m_Unlinked; break; default: throw new ArgumentException("Unknown enumeration value for DeckTraversalSelector: " + value.ToString()); } this.RegisterActiveEventListeners(); }