/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// Notice that we want to be careful about how groups are removed and added. If we remove a group, even if /// we intend to add it back immediately, we can miss network transmissions to that group in the window /// of our non-membership. To avoid this, we should only add/remove groups when necessary, never remove /// 'All Participants' (eg. never do Groups.Clear), and do adds before removes. /// Another solution to this would be to merge all group changes into one atomic GroupUpdate message. private void onRoleChange(object sender, PropertyEventArgs e) { RoleModel role = null; using (Synchronizer.Lock(this.m_Participant.SyncRoot)) { if (m_Participant.Role == null) { return; } role = m_Participant.Role; } using(Synchronizer.Lock(this.m_SlideViewer.SlideDisplay.SyncRoot)) { this.m_SlideViewer.SlideDisplay.SheetDisposition = Model.Presentation.SheetDisposition.All | Model.Presentation.SheetDisposition.Background; if (role is Model.Network.InstructorModel) { addGroup(Group.AllInstructor); addGroup(Group.Submissions); removeGroup(Group.AllPublic); removeGroup(Group.AllStudent); this.m_SlideViewer.SlideDisplay.SheetDisposition ^= Model.Presentation.SheetDisposition.Instructor; } else if (role is Model.Network.StudentModel) { addGroup(Group.AllStudent); removeGroup(Group.AllPublic); removeGroup(Group.AllInstructor); removeGroup(Group.Submissions); this.m_SlideViewer.SlideDisplay.SheetDisposition ^= Model.Presentation.SheetDisposition.Student; } else if (role is Model.Network.PublicModel) { addGroup(Group.AllPublic); addGroup(Group.Submissions); removeGroup(Group.AllInstructor); removeGroup(Group.AllStudent); this.m_SlideViewer.SlideDisplay.SheetDisposition ^= Model.Presentation.SheetDisposition.Public; } } }
protected void HandleRoleChanged(object sender, PropertyEventArgs e) { // Bug 988: Completely disable the role menu for the Instructor role. using (Synchronizer.Lock(this.m_Model.Participant.SyncRoot)) { this.Enabled = this.Visible = !(this.m_Model.Participant.Role is InstructorModel); } }
private void HandleQuickPollChanged( object sender, PropertyEventArgs args ) { Group receivers = Group.AllParticipant; this.SendQuickPollChanged( receivers ); if( this.m_QuickPollNetworkService != null ) { this.m_QuickPollNetworkService.Dispose(); } this.m_QuickPollNetworkService = new QuickPollNetworkService( this.m_Sender, this.m_Presentation ); }
/// <summary> /// Message from instructor to student. /// </summary> /// <param name="o"></param> /// <param name="args"></param> private void InstructorSendStatus(object o, PropertyEventArgs args) { PropertyChangeEventArgs pcea = (PropertyChangeEventArgs)args; //The Id is actually the student Participant ID. Guid StudentId = (Guid)pcea.NewValue; if (!StudentId.Equals(Guid.Empty)) { Group studentGroup = new SingletonGroup(new ParticipantModel(StudentId)); sender_.Post(delegate() { this.SendStatusHelper(studentGroup); }); } }
private void OnParticipantNameChanged(object sender, PropertyEventArgs args) { if (args is PropertyChangeEventArgs) { PropertyChangeEventArgs pcargs = (PropertyChangeEventArgs)args; this.m_ParticipantName = "Anonymous Instructor"; if (pcargs.NewValue != null) this.m_ParticipantName = (string)pcargs.NewValue; } UpdateMessage(); }
private void HandleSlideChanged(object sender, PropertyEventArgs args) { using(Synchronizer.Lock(this)) { SlideModel slide; using(Synchronizer.Lock(this.m_SlideDisplay.SyncRoot)) { slide = this.m_SlideDisplay.Slide; // Release the reader lock immediately, because it is not possible (or at least easy) // to guarantee consistent locking order between the SlideDisplayModel and the SlideModel. // Most of the SheetRenderer classes will obtain a lock on the SlideModel *first* // and the SlideDisplayModel *second* because they react to changes in the slide; // but that order is not possible here. } if(slide == null) { this.m_Adaptee.InkSheetModel = null; this.m_Adaptee.RealTimeInkSheetModel = null; } else { using(Synchronizer.Lock(slide.SyncRoot)) { try { InkSheetModel inks = null; RealTimeInkSheetModel rti = null; // TODO: This code is duplicated in SlideToolBarButtons.ClearInkSheetToolBarButton. Extract to a "ActiveInkAnnotationSheet" property of the SlideModel. // Find the *top-most* InkSheetModel and RealTimeInkSheetModel in the annotation layer. foreach(SheetModel sheet in slide.AnnotationSheets) { // Only consider local sheets. if((sheet.Disposition & SheetDisposition.Remote) != 0) { continue; // RealTimeInkSheetModels get priority. } else if(sheet is RealTimeInkSheetModel) { inks = rti = ((RealTimeInkSheetModel) sheet); // Regular InkSheetModels are our second choice. } else if(sheet is InkSheetModel) { inks = ((InkSheetModel) sheet); rti = null; // Only consider the *top-most* non-remote sheet (the last one in the collection). } else { continue; } } if(inks == null && rti == null) { // If the slide does not have an ink annotation sheet, create one. inks = rti = new RealTimeInkSheetModel(Guid.NewGuid(), SheetDisposition.All, Rectangle.Empty); // Add it to the slide. slide.AnnotationSheets.Add(rti); } // Start collecting ink into the InkSheetModel's Ink object // (after the sheet is added to the slide, so renderers don't get out of sync). // Also start sending events to InkSheetModel.RealTimeInk. this.m_Adaptee.InkSheetModel = rti == null ? inks : rti; this.m_Adaptee.RealTimeInkSheetModel = rti; } catch { // We were unable to get an Ink annotation sheet, so disable inking. this.m_Adaptee.InkSheetModel = null; this.m_Adaptee.RealTimeInkSheetModel = null; throw; } } } } }
private void OnBroadcastDisabledChanged(object sender, PropertyEventArgs args) { if (args is PropertyChangeEventArgs) { PropertyChangeEventArgs pcargs = (PropertyChangeEventArgs)args; m_BroadcastDisabled = (bool)pcargs.NewValue; } }
private void OnLightColorChanged(object sender, PropertyEventArgs args) { bool lightcolor = false; using (Synchronizer.Lock(((PresentItBox)(this.Parent)).viewer_.presenter_model_.ViewerState.SyncRoot)) { lightcolor = ((PresentItBox)(this.Parent)).viewer_.presenter_model_.ViewerState.UseLightColorSet; } if (lightcolor == false) { this.BackColor = Color.White; this.Parent.BackColor = Color.White; } else { this.BackColor = Color.DarkGray; this.Parent.BackColor = Color.DarkGray; } }
private void ResolutionWidthTextbox_TextChanged(Control sender, PropertyEventArgs<string> args) { settings.Set("Width", args.NewValue); optionsScreen.NeedRestart(); }
public void TextOnRoleChange(object sender, PropertyEventArgs args) { using (Synchronizer.Lock(this.m_Model.ViewerState)) { if (this.m_Model.ViewerState.iRole == 0 || //disconnected this.m_Model.ViewerState.iRole == 2) { //instructor this.Text = text1; } else { this.Text = text2; } } }
/// <summary> /// Event handler for checking the properties the control if the size of preview window changed or not /// </summary> /// <param name="sender">the object invoking us</param> /// <param name="args">the arguments to our event</param> private void HandleSlidePreviewSizeChanged(object sender, PropertyEventArgs args) { Size newsize = new Size(400, 300); using (Synchronizer.Lock(this.m_Model.ViewerState.SyncRoot)) { newsize = new Size(this.m_Model.ViewerState.SlidePreviewWidth, this.m_Model.ViewerState.SlidePreviewHeight); } this.Size = newsize; this.OnLinkedControlSizeChanged(sender, args); }
protected virtual void OnSlot2Changed(PropertyEventArgs<Control> args) { }
protected virtual void OnSplitterPositionChanged(PropertyEventArgs<int> args) { }
private void HandleRoleChanged(object sender, PropertyEventArgs args_) { using(Synchronizer.Lock(this)) { if(this.m_Association != null) { using(Synchronizer.Lock(this.m_Association.SyncRoot)) { this.Instructor = this.m_Association.Role as InstructorModel; } } else { this.Instructor = null; } } }
protected abstract void HandleRoleChanged(object sender, PropertyEventArgs e);
private void HandleCurrentPresentationChanged(object sender, PropertyEventArgs args_) { using(Synchronizer.Lock(this)) { if(this.m_Instructor == null) { this.CurrentPresentation = null; } else { using(Synchronizer.Lock(this.m_Instructor.SyncRoot)) { this.CurrentPresentation = this.m_Instructor.CurrentPresentation; // Release the lock before proceeding because there is no "natural" parent/child locking order. } } using(this.m_Model.Workspace.Lock()) { this.m_Model.Workspace.CurrentPresentation.Value = this.CurrentPresentation; } } }
private void HandleCurrentDeckTraversalChanged(object sender, PropertyEventArgs args_) { using (Synchronizer.Lock(this)) { DeckTraversalModel current; if (this.m_Instructor == null) { current = null; } else { using (Synchronizer.Lock(this.m_Instructor.SyncRoot)) { current = this.m_Instructor.CurrentDeckTraversal; } } using (this.m_Model.Workspace.Lock()) { if (current != null) { // Check the workspace to see if there exists a linkedDeckTraversal for this ID foreach (DeckTraversalModel model in this.m_Model.Workspace.DeckTraversals) { if (model.Id == current.Id) { current = model; break; } } } } // TODO: Only set the current deck traversal if navigation is unlinked. bool isInstructor = false; using (Synchronizer.Lock(this.m_Model.Participant.SyncRoot)) { if (this.m_Model.Participant.Role is InstructorModel) { isInstructor = true; } } DeckTraversalModel dtm = null; if ((current is LinkedDeckTraversalModel) || (isInstructor) || (current == null)) { dtm = current; } else { dtm = new LinkedDeckTraversalModel(this.m_EventQueue, current.Id, this.m_Model, current); } using (this.m_Model.Workspace.Lock()) { this.m_Model.Workspace.CurrentDeckTraversal.Value = dtm; } } }
private void HandleAssociationChanged(object sender, PropertyEventArgs args_) { using(Synchronizer.Lock(this)) { using(Synchronizer.Lock(this.m_Model.Network.SyncRoot)) { this.Association = this.m_Model.Network.Association; } } }
private void OnPresentationNameChanged(object sender, PropertyEventArgs args) { if (args is PropertyChangeEventArgs) { PropertyChangeEventArgs pcargs = (PropertyChangeEventArgs)args; this.m_PresentationName = "Untitled Presentation"; if (pcargs.NewValue != null) this.m_PresentationName = (string)pcargs.NewValue; } //Update the broadcast message UpdateMessage(); }
private void OnNetworkStatusChanged(object sender, PropertyEventArgs args) { using (Synchronizer.Lock(this.m_NetworkStatusProviders)) { NetworkStatus newStatus = ((NetworkStatus)((PropertyChangeEventArgs)args).NewValue).Clone(); m_NetworkStatusProviders[sender] = newStatus; if (m_NetworkStatusProviders.Count != 1) { newStatus = new NetworkStatus(); } if (m_NetworkStatus.StatusChanged(newStatus)) { using (Synchronizer.Lock(this.SyncRoot)) { this.SetPublishedProperty("NetworkStatus", ref this.m_NetworkStatus, newStatus); } } } }
private void OnShowIPChanged(object sender, PropertyEventArgs args) { using (Synchronizer.Lock(m_Model.ViewerState.SyncRoot)) { this.m_showIP = m_Model.ViewerState.ShowIP; } UpdateMessage(); }
private void RoleChangedHandler(object sender, PropertyEventArgs args) { PropertyChangeEventArgs pcea = (PropertyChangeEventArgs)args; if (pcea.NewValue is InstructorModel) { m_RemoteNodeIsInstructor = true; } else { m_RemoteNodeIsInstructor = false; } }
protected virtual void OnSlot2MinSizeChanged(PropertyEventArgs<int?> args) { }
protected override void HandleRoleChanged(object sender, PropertyEventArgs e) { using(Synchronizer.Lock(this.m_Model.Participant.SyncRoot)) { if(this.m_Model.Participant.Role is PublicModel) { this.Checked = true; this.m_LastRole = this.m_Model.Participant.Role; } else { this.Checked = false; } } }
protected virtual void OnSplitterSizeChanged(PropertyEventArgs<int> args) { }
/// <summary> /// Event handler that's invoked there is a change in logging enabled or path /// </summary> /// <param name="sender">The object that was changed</param> /// <param name="args">Information about the changed property</param> private void OnLoggingChanged( object sender, PropertyEventArgs args ) { using(Synchronizer.Lock(this.m_ViewerState.SyncRoot)) { if( this.m_ViewerState.LoggingEnabled ) { this.SetupLogFileHelper( this.m_ViewerState.LoggingPath ); } else this.DetachLogger(); } }
/// <summary> /// Event handler for checking the properties the control if we are visible or not /// </summary> /// <param name="sender">the object invoking us</param> /// <param name="args">the arguments to our event</param> private void HandleSlidePreviewChanged(object sender, PropertyEventArgs args) { // Check if we need to make this control visible or not using (Synchronizer.Lock(this.m_Model.ViewerState.SyncRoot)) { this.Visible = (this.m_Model.ViewerState.SlidePreviewEnabled && this.m_Model.ViewerState.SlidePreviewVisible); } }
/// <summary> /// Handle when the CurrentDeckTraversal member of the /// InstructorModel changes /// </summary> /// <param name="sender">The object that posted this event</param> /// <param name="args">The arguments for this event</param> private void HandleCurrentDeckTraversalChanged(object sender, PropertyEventArgs args) { // Need to update the current deck if we change it as well as the // current slide in the deck if it changes this.UpdateCurrentDeckTraversal(); }
private void onRoleChange(object sender, PropertyEventArgs e) { using (Synchronizer.Lock(this.m_Model.Participant.SyncRoot)) { using (Synchronizer.Lock(this.m_PreviewSlideViewer.SlideDisplay.SyncRoot)) { this.m_PreviewSlideViewer.SlideDisplay.SheetDisposition = Model.Presentation.SheetDisposition.All | Model.Presentation.SheetDisposition.Background; if (this.m_Model.Participant.Role is Model.Network.InstructorModel) { this.m_PreviewSlideViewer.SlideDisplay.SheetDisposition ^= Model.Presentation.SheetDisposition.Instructor; } else if (this.m_Model.Participant.Role is Model.Network.StudentModel) { this.m_PreviewSlideViewer.SlideDisplay.SheetDisposition ^= Model.Presentation.SheetDisposition.Student; } else if (this.m_Model.Participant.Role is Model.Network.PublicModel) { this.m_PreviewSlideViewer.SlideDisplay.SheetDisposition ^= Model.Presentation.SheetDisposition.Public; } } } }
/// <summary> /// Handle when a basic change happens to the InstructorModel /// </summary> /// <param name="sender">The object that posted this event</param> /// <param name="args">The arguments for this event</param> private void HandleGenericChange(object sender, PropertyEventArgs args) { bool acceptingSS = false; bool acceptingQP = false; bool forceLink = false; // Get the slide and deck index using (Synchronizer.Lock(this.m_Instructor.SyncRoot)) { acceptingSS = this.m_Instructor.AcceptingStudentSubmissions; acceptingQP = this.m_Instructor.AcceptingQuickPollSubmissions; forceLink = this.m_Instructor.ForcingStudentNavigationLock; } // Change the SimpleWebModel lock (WebService.Instance.GlobalModel) { WebService.Instance.GlobalModel.AcceptingSS = acceptingSS; WebService.Instance.GlobalModel.AcceptingQP = acceptingQP; WebService.Instance.GlobalModel.ForceLink = forceLink; } WebService.Instance.UpdateModel(); }