/// <summary> /// Constructor /// </summary> /// <param name="sender">The sending queue to post messages to</param> /// <param name="role">The InstructorModel to create this class for</param> public InstructorNetworkService(SendingQueue sender, InstructorModel role) : base(sender, role) { this.m_Instructor = role; // Create the submission status service submission_status_service_ = new SubmissionStatusNetworkService(this.Sender, role); // Handle basic changes this.m_GenericChangeDispatcher = new EventQueue.PropertyEventDispatcher(this.Sender, new PropertyEventHandler(this.HandleGenericChange)); this.m_Instructor.Changed["ForcingStudentNavigationLock"].Add(this.m_GenericChangeDispatcher.Dispatcher); this.m_Instructor.Changed["AcceptingStudentSubmissions"].Add(this.m_GenericChangeDispatcher.Dispatcher); this.m_Instructor.Changed["AcceptingQuickPollSubmissions"].Add(this.m_GenericChangeDispatcher.Dispatcher); this.m_Instructor.Changed["StudentNavigationType"].Add(this.m_GenericChangeDispatcher.Dispatcher); // Handle changes to the current presentation this.m_CurrentPresentationChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.Sender, new PropertyEventHandler(this.HandleCurrentPresentationChanged)); this.m_Instructor.Changed["CurrentPresentation"].Add(this.m_CurrentPresentationChangedDispatcher.Dispatcher); this.m_CurrentPresentationChangedDispatcher.Dispatcher(this, null); // Handle changes to the current deck traversal this.m_CurrentDeckTraversalChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.Sender, new PropertyEventHandler(this.HandleCurrentDeckTraversalChanged)); this.m_Instructor.Changed["CurrentDeckTraversal"].Add(this.m_CurrentDeckTraversalChangedDispatcher.Dispatcher); this.m_CurrentDeckTraversalChangedDispatcher.Dispatcher(this, null); #if WEBSERVER // Create the web service equivalent to this service this.m_InstructorWebService = new Web.Network.InstructorWebService( this.Sender, role ); using (Synchronizer.Lock(PresenterModel.TheInstance.SyncRoot)) { using (Synchronizer.Lock(PresenterModel.TheInstance.ViewerState.SyncRoot)) { this.m_WebPerformanceWebService = new Web.Network.WebPerformanceWebService(this.Sender, PresenterModel.TheInstance.ViewerState.WebPerformance); } } #endif }
/// <summary> /// Constructor /// </summary> /// <param name="sender">The sending queue for this class</param> /// <param name="model">The PresenterModel for the network service</param> /// <param name="role">The StudentModel for this network service</param> public StudentNetworkService(SendingQueue sender, PresenterModel model, StudentModel role) : base(sender, role) { this.m_Student = role; this.m_Model = model; // Instanciate the submission status service submission_status_service_ = new SubmissionStatusNetworkService(this.Sender, role); // Create a delegate that will update the local copy of the current // presentation whenever it changes in the workspace. // // This causes the set{} accessor for CurrentPresentation to be run, // which as a side effect disposes of and recreates all the network // services associated with the student. this.m_PresentationChangedDispatcher = this.m_Model.Workspace.CurrentPresentation.ListenAndInitialize(sender, delegate(Property<PresentationModel>.EventArgs args) { if (args.New != null) { this.CurrentPresentation = args.New; } }); }
/// <summary> /// Constructor /// </summary> /// <param name="sender">The sending queue to post messages to</param> /// <param name="role">The InstructorModel to create this class for</param> public InstructorNetworkService(SendingQueue sender, InstructorModel role) : base(sender, role) { this.m_Instructor = role; // Create the submission status service submission_status_service_ = new SubmissionStatusNetworkService(this.Sender, role); // Handle basic changes this.m_GenericChangeDispatcher = new EventQueue.PropertyEventDispatcher(this.Sender, new PropertyEventHandler(this.HandleGenericChange)); this.m_Instructor.Changed["ForcingStudentNavigationLock"].Add(this.m_GenericChangeDispatcher.Dispatcher); this.m_Instructor.Changed["AcceptingStudentSubmissions"].Add(this.m_GenericChangeDispatcher.Dispatcher); this.m_Instructor.Changed["AcceptingQuickPollSubmissions"].Add(this.m_GenericChangeDispatcher.Dispatcher); // Handle changes to the current presentation this.m_CurrentPresentationChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.Sender, new PropertyEventHandler(this.HandleCurrentPresentationChanged)); this.m_Instructor.Changed["CurrentPresentation"].Add(this.m_CurrentPresentationChangedDispatcher.Dispatcher); this.m_CurrentPresentationChangedDispatcher.Dispatcher(this, null); // Handle changes to the current deck traversal this.m_CurrentDeckTraversalChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.Sender, new PropertyEventHandler(this.HandleCurrentDeckTraversalChanged)); this.m_Instructor.Changed["CurrentDeckTraversal"].Add(this.m_CurrentDeckTraversalChangedDispatcher.Dispatcher); this.m_CurrentDeckTraversalChangedDispatcher.Dispatcher(this, null); }