/// <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;
         }
     }
 }
Example #2
0
 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 RoleChangedHandler(object sender, PropertyEventArgs args)
 {
     PropertyChangeEventArgs pcea = (PropertyChangeEventArgs)args;
     if (pcea.NewValue is InstructorModel) {
         m_RemoteNodeIsInstructor = true;
     }
     else {
         m_RemoteNodeIsInstructor = false;
     }
 }
Example #6
0
 protected virtual void OnSplitterSizeChanged(PropertyEventArgs <int> args)
 {
 }
Example #7
0
 protected virtual void OnSplitterPositionChanged(PropertyEventArgs <int> args)
 {
 }
Example #8
0
 protected virtual void OnSlot2Changed(PropertyEventArgs<Control> args)
 {
 }
Example #9
0
 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);
             }
         }
     }
 }
Example #10
0
 protected abstract void HandleRoleChanged(object sender, PropertyEventArgs e);
Example #11
0
 private void OnBroadcastDisabledChanged(object sender, PropertyEventArgs args)
 {
     if (args is PropertyChangeEventArgs) {
         PropertyChangeEventArgs pcargs = (PropertyChangeEventArgs)args;
         m_BroadcastDisabled = (bool)pcargs.NewValue;
     }
 }
Example #12
0
 private void HandleChange(object sender, PropertyEventArgs args)
 {
     this.SendGenericChange(Group.AllParticipant);
 }
Example #13
0
 private void OnFilmStripAlignmentChanged(object sender, PropertyEventArgs args)
 {
     using (Synchronizer.Lock(this.m_Model.ViewerState.SyncRoot))
         this.Dock = this.m_Model.ViewerState.FilmStripAlignment;
 }
Example #14
0
 public void Context_WroteProperty_Cnt(object sender, PropertyEventArgs e)
 {
     wroteCnt++;
 }
 protected override void HandleBoundsChanged(object sender, PropertyEventArgs args)
 {
     SendQuickPollSheet(Group.AllParticipant);
 }
Example #16
0
 public void Context_ReadProperty_Cnt(object sender, PropertyEventArgs e)
 {
     readCnt++;
 }
        /// <summary>
        /// Change the color set the button based on the property option
        /// </summary>
        /// <param name="e"></param>
        public void HandleColorSetChanged(object sender, PropertyEventArgs args)
        {
            Color  color;
            string tooltip = "";

            foreach (StylusEntry stylus in this.m_Table.Values)
            {
                if (stylus.PenType == PenType.Pen || stylus.PenType == PenType.Text)
                {
                    color = stylus.DrawingAttributes.Color;

                    using (Synchronizer.Lock(this.m_Model.ViewerState.SyncRoot)) {
                        if (this.m_Model.ViewerState.UseLightColorSet)
                        {
                            if (color == Color.Black)
                            {
                                color   = Color.White;
                                tooltip = (stylus.PenType == PenType.Pen) ? Strings.SelectWhitePen : Strings.WhiteText;
                            }
                            else if (color == Color.Red)
                            {
                                color   = Color.Pink;
                                tooltip = (stylus.PenType == PenType.Pen) ? Strings.SelectPinkPen : Strings.PinkText;
                            }
                            else if (color == Color.Green)
                            {
                                color   = Color.LightGreen;
                                tooltip = (stylus.PenType == PenType.Pen) ? Strings.SelectLightgreenPen : Strings.LightgreenText;
                            }
                            else if (color == Color.Blue)
                            {
                                color   = Color.LightBlue;
                                tooltip = (stylus.PenType == PenType.Pen) ? Strings.SelectLightbluePen : Strings.LightblueText;
                            }
                        }
                        else
                        {
                            if (color == Color.White)
                            {
                                color   = Color.Black;
                                tooltip = (stylus.PenType == PenType.Pen) ? Strings.SelectBlackPen : Strings.BlackText;
                            }
                            else if (color == Color.LightBlue)
                            {
                                color   = Color.Blue;
                                tooltip = (stylus.PenType == PenType.Pen) ? Strings.SelectBluePen: Strings.BlueText;
                            }
                            else if (color == Color.Pink)
                            {
                                color   = Color.Red;
                                tooltip = (stylus.PenType == PenType.Pen) ? Strings.SelectRedPen : Strings.RedText;
                            }
                            else if (color == Color.LightGreen)
                            {
                                color   = Color.Green;
                                tooltip = (stylus.PenType == PenType.Pen) ? Strings.SelectGreenPen : Strings.GreenText;
                            }
                        }
                    }

                    if (color != stylus.DrawingAttributes.Color)
                    {
                        stylus.DrawingAttributes.Color = color;
                        stylus.ToolTipText             = string.Copy(tooltip);
                    }
                }
            }

            if (this.m_CurrentStylus != null)
            {
                using (Synchronizer.Lock(this.m_CurrentStylus.SyncRoot)) {
                    color = this.m_CurrentStylus.DrawingAttributes.Color;
                }

                using (Synchronizer.Lock(this.m_Model.ViewerState.SyncRoot)) {
                    if (this.m_Model.ViewerState.UseLightColorSet)
                    {
                        if (color == Color.Black)
                        {
                            color = Color.White;
                        }
                        else if (color == Color.Red)
                        {
                            color = Color.Pink;
                        }
                        else if (color == Color.Green)
                        {
                            color = Color.LightGreen;
                        }
                        else if (color == Color.Blue)
                        {
                            color = Color.LightBlue;
                        }
                    }
                    else
                    {
                        if (color == Color.White)
                        {
                            color = Color.Black;
                        }
                        else if (color == Color.LightBlue)
                        {
                            color = Color.Blue;
                        }
                        else if (color == Color.Pink)
                        {
                            color = Color.Red;
                        }
                        else if (color == Color.LightGreen)
                        {
                            color = Color.Green;
                        }
                    }
                }

                using (Synchronizer.Lock(this.m_CurrentStylus.SyncRoot)) {
                    if (color != this.m_CurrentStylus.DrawingAttributes.Color)
                    {
                        this.m_CurrentStylus.DrawingAttributes.Color = color;
                    }
                }
            }
            this.HandleDrawingAttributesChanged(this.m_CurrentStylus, null);
        }
        /// <summary>
        /// Handle the stylus changing
        /// </summary>
        /// <param name="sender">The event sender</param>
        /// <param name="args">The event arguments</param>
        private void HandleStylusChanged(object sender, PropertyEventArgs args)
        {
            bool  enable;
            Color color;

            using (Synchronizer.Lock(this.m_Model.SyncRoot)) {
                if (this.m_Model.Stylus != null && this.m_Table.ContainsKey(this.m_Model.Stylus))
                {
                    using (Synchronizer.Lock(this.m_Model.Stylus.SyncRoot)) {
                        color = this.m_Model.Stylus.DrawingAttributes.Color;
                    }

                    using (Synchronizer.Lock(this.m_Model.ViewerState.SyncRoot)) {
                        if (this.m_Model.ViewerState.UseLightColorSet)
                        {
                            if (color == Color.Black)
                            {
                                color = Color.White;
                            }
                            else if (color == Color.Red)
                            {
                                color = Color.Pink;
                            }
                            else if (color == Color.Green)
                            {
                                color = Color.LightGreen;
                            }
                            else if (color == Color.Blue)
                            {
                                color = Color.LightBlue;
                            }
                        }
                        else
                        {
                            if (color == Color.White)
                            {
                                color = Color.Black;
                            }
                            else if (color == Color.LightBlue)
                            {
                                color = Color.Blue;
                            }
                            else if (color == Color.Pink)
                            {
                                color = Color.Red;
                            }
                            else if (color == Color.LightGreen)
                            {
                                color = Color.Green;
                            }
                        }
                    }

                    using (Synchronizer.Lock(this.m_Model.Stylus.SyncRoot)) {
                        if (color != this.m_Model.Stylus.DrawingAttributes.Color)
                        {
                            this.m_Model.Stylus.DrawingAttributes.Color = color;
                        }
                    }
                    // In addition to enabling the button, update the current stylus
                    // and DrawingAttributes (possibly causing redrawing the bitmap).
                    this.m_CurrentStylus = this.m_Model.Stylus;
                    this.HandleDrawingAttributesChanged(this.m_Model.Stylus, null);
                    enable = true;
                }
                else
                {
                    enable = false;
                }
            }

            this.Enabled = enable;
        }
 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;
         }
     }
 }
        /// <summary>
        /// Handle changes to the server state
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void HandleServerStateChange(object sender, PropertyEventArgs args)
        {
            using (Synchronizer.Lock(this.m_Diagnostic.SyncRoot)) {
                if (this.m_Diagnostic.ServerState == DiagnosticModel.ServerSyncState.BEGIN)
                {
                    // Stop the timer
                    this.m_Timer.Stop();

                    // Clear the variables
                    this.myParticipants          = new ArrayList();
                    this.currentParticipantIndex = -1;

                    // Get a list of participants that we need to sync
                    using (this.m_Model.Workspace.Lock())
                        // Get each non-instructor participant ID
                        foreach (ParticipantModel p in this.Sender.Classroom.Participants)
                        {
                            using (Synchronizer.Lock(p.SyncRoot))
                                using (Synchronizer.Lock(p.Role.SyncRoot))
                                    if (!(p.Role is InstructorModel))
                                    {
                                        this.myParticipants.Add(p.Role.Id);
                                    }
                        }

                    // Go to the syncing state
                    this.m_Diagnostic.ServerState = DiagnosticModel.ServerSyncState.SYNCING;
                }
                else if (this.m_Diagnostic.ServerState == DiagnosticModel.ServerSyncState.SYNCING)
                {
                    // Increment the participant number
                    currentParticipantIndex++;

                    // Make sure there are more participants
                    if (currentParticipantIndex >= this.myParticipants.Count)
                    {
                        this.m_Diagnostic.ServerState = DiagnosticModel.ServerSyncState.START;
                        return;
                    }

                    // Send the Sync Begin Message
                    this.Sender.Send(new SyncBeginMessage((Guid)this.myParticipants[this.currentParticipantIndex]));
                    this.m_Timer.Start();
                }
                else if (this.m_Diagnostic.ServerState == DiagnosticModel.ServerSyncState.PONGING)
                {
                    // Stop the timer
                    this.m_Timer.Stop();

                    // Make sure there are more participants
                    if (currentParticipantIndex >= this.myParticipants.Count)
                    {
                        return;
                    }

                    // Send the Pong Message
                    this.Sender.Send(new SyncPongMessage((Guid)this.myParticipants[this.currentParticipantIndex]));

                    // Return the the Syncing State
                    this.m_Diagnostic.ServerState = DiagnosticModel.ServerSyncState.SYNCING;
                }
                else
                {
                    // Stop the timer
                    this.m_Timer.Stop();
                }
            }
        }
        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;
                }
            }
        }
Example #22
0
 protected virtual void OnVerticalScrollbarEnabledChanged(PropertyEventArgs <bool> args)
 {
 }
Example #23
0
 /// <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 OnPageSetupChanged(object sender, PropertyEventArgs args)
 {
     using (Synchronizer.Lock(this.m_ViewerState.SyncRoot)) {
         this.m_PagesPerSheet = this.m_ViewerState.SlidesPerPage;
     }
 }
Example #24
0
 protected virtual void OnVerticalScrollbarVisibleChanged(PropertyEventArgs <bool?> args)
 {
 }
Example #25
0
        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();
        }
Example #26
0
 protected virtual void OnVerticalScrollPositionChanged(PropertyEventArgs <int> args)
 {
 }
Example #27
0
 protected virtual void OnSplitterPositionChanged(PropertyEventArgs<int> args)
 {
 }
Example #28
0
 protected virtual void OnVirtualSizeChanged(PropertyEventArgs <Point> args)
 {
 }
Example #29
0
 /// <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);
 }
Example #30
0
 protected virtual void OnSelectedItemBrushChanged(PropertyEventArgs <Brush> args)
 {
 }
Example #31
0
 private void HandleToolBarModeChanged(object sender, PropertyEventArgs e)
 {
     using (Synchronizer.Lock(this.m_Model.ViewerState.SyncRoot))
         this.Checked = (this.m_Model.ViewerState.ClassmateMode == this.m_ClassmateMode);
 }
Example #32
0
        /// <summary>
        /// Send the current ink as a student submission slide
        /// </summary>
        /// <param name="sender">The object which sent this event, i.e. this class</param>
        /// <param name="args">The parameters for the property</param>
        private void HandleSendSubmission(object sender, PropertyEventArgs args)
        {
            if (this.m_SendingLock)
            {
                return;
            }

            using (Synchronizer.Lock(SubmissionStatusModel.GetInstance().SyncRoot)) {
                SubmissionStatusModel.GetInstance().SubmissionStatus = SubmissionStatusModel.Status.NotReceived;
            }


            ///declare variables we will be using
            UW.ClassroomPresenter.Network.Messages.Message pres, deck, slide, sheet;
            // Construct the message to send
            using (this.m_Model.Workspace.Lock()) {
                // Add the presentation
                if (this.m_Model.Workspace.CurrentPresentation == null)
                {
                    return;
                }
                ///the presentation message we will be sending
                pres       = new PresentationInformationMessage(this.m_Model.Workspace.CurrentPresentation);
                pres.Group = Groups.Group.Submissions;

                //Add the current deck model that corresponds to this slide deck at the remote location
                if ((~this.m_Model.Workspace.CurrentDeckTraversal) == null)
                {
                    return;
                }
                using (Synchronizer.Lock((~this.m_Model.Workspace.CurrentDeckTraversal).SyncRoot)) {
                    DeckModel dModel = (~this.m_Model.Workspace.CurrentDeckTraversal).Deck;
                    foreach (DeckPairModel match in this.m_Model.Workspace.DeckMatches)
                    {
                        ///check to see if the decks are the same
                        if (match.LocalDeckTraversal.Deck == (~this.m_Model.Workspace.CurrentDeckTraversal).Deck)
                        {
                            dModel = match.RemoteDeckTraversal.Deck;
                        }
                    }
                    ///create the deck message from this matched deck
                    deck = new DeckInformationMessage(dModel);
                    ///make the deck a submission type deck.
                    deck.Group = Groups.Group.Submissions;
                    ///tack this message onto the end.
                    pres.InsertChild(deck);

                    ///add the particular slide we're on the to message.
                    if ((~this.m_Model.Workspace.CurrentDeckTraversal).Current == null)
                    {
                        return;
                    }
                    using (Synchronizer.Lock((~this.m_Model.Workspace.CurrentDeckTraversal).Current.Slide.SyncRoot)) {
                        // Add the Slide Message
                        slide       = new StudentSubmissionSlideInformationMessage((~this.m_Model.Workspace.CurrentDeckTraversal).Current.Slide, Guid.NewGuid(), Guid.NewGuid());
                        slide.Group = Groups.Group.Submissions;
                        deck.InsertChild(slide);

                        // Find the correct user ink layer to send
                        RealTimeInkSheetModel m_Sheet = null;
                        int count = 0;
                        foreach (SheetModel s in (~this.m_Model.Workspace.CurrentDeckTraversal).Current.Slide.AnnotationSheets)
                        {
                            if (s is RealTimeInkSheetModel && (s.Disposition & SheetDisposition.Remote) == 0)
                            {
                                m_Sheet = (RealTimeInkSheetModel)s;
                                count++;
                            }
                        }

                        // DEBUGGING
                        if (count > 1)
                        {
                            Debug.Assert(true, "Bad Count", "Bad");
                        }

                        // Find the existing ink on the slide
                        Ink extracted;
                        using (Synchronizer.Lock(m_Sheet.Ink.Strokes.SyncRoot)) {
                            // Ensure that each stroke has a Guid which will uniquely identify it on the remote side
                            foreach (Stroke stroke in m_Sheet.Ink.Strokes)
                            {
                                if (!stroke.ExtendedProperties.DoesPropertyExist(InkSheetMessage.StrokeIdExtendedProperty))
                                {
                                    stroke.ExtendedProperties.Add(InkSheetMessage.StrokeIdExtendedProperty, Guid.NewGuid().ToString());
                                }
                            }
                            // Extract all of the strokes
                            extracted = m_Sheet.Ink.ExtractStrokes(m_Sheet.Ink.Strokes, ExtractFlags.CopyFromOriginal);
                        }


                        // Find the Realtime ink on the slide
                        RealTimeInkSheetModel newSheet = null;
                        using (Synchronizer.Lock(m_Sheet.SyncRoot)) {
                            newSheet = new RealTimeInkSheetModel(Guid.NewGuid(), m_Sheet.Disposition | SheetDisposition.Remote, m_Sheet.Bounds);
                            using (Synchronizer.Lock(newSheet.SyncRoot)) {
                                newSheet.CurrentDrawingAttributes = m_Sheet.CurrentDrawingAttributes;
                            }
                        }

                        // Add a message to *create* the student's RealTimeInkSheetModel on the instructor client (without any ink).
                        sheet       = SheetMessage.ForSheet(newSheet, SheetMessage.SheetCollection.AnnotationSheets);
                        sheet.Group = Groups.Group.Submissions;
                        slide.InsertChild(sheet);

                        //Scale the ink if necessary
                        if (ViewerStateModel.NonStandardDpi)
                        {
                            extracted.Strokes.Transform(ViewerStateModel.DpiNormalizationSendMatrix);
                        }

                        // Add a message to copy the ink from the student's RealTimeInkSheetModel to the just-created sheet on the instructor.
                        sheet       = new InkSheetStrokesAddedMessage(newSheet, (Guid)slide.TargetId, SheetMessage.SheetCollection.AnnotationSheets, extracted);
                        sheet.Group = Groups.Group.Submissions;
                        slide.InsertChild(sheet);

                        ///Add each text and image sheet into the message as children of the ink sheet if it is public
                        foreach (SheetModel s in (~this.m_Model.Workspace.CurrentDeckTraversal).Current.Slide.AnnotationSheets)
                        {
                            if (s is TextSheetModel && !(s is StatusLabel) && (s.Disposition & SheetDisposition.Remote) == 0)
                            {
                                TextSheetModel text_sheet = (TextSheetModel)s;
                                text_sheet = (TextSheetModel)text_sheet.Clone();
                                ///some ugly code here due to synchronization
                                bool sheet_is_public;
                                using (Synchronizer.Lock(text_sheet.SyncRoot)) {
                                    sheet_is_public = text_sheet.IsPublic;
                                }
                                if (sheet_is_public)
                                {
                                    TextSheetMessage t_message = new TextSheetMessage(text_sheet, SheetMessage.SheetCollection.AnnotationSheets);
                                    t_message.Group = Groups.Group.Submissions;
                                    slide.InsertChild(t_message);
                                }
                            }
                            if (s is ImageSheetModel && !(s is StatusLabel) && (s.Disposition & SheetDisposition.Remote) == 0)
                            {
                                ImageSheetModel image_sheet = (ImageSheetModel)s;
                                image_sheet = (ImageSheetModel)image_sheet.Clone();
                                ImageSheetMessage i_message = new ImageSheetMessage(image_sheet, SheetMessage.SheetCollection.AnnotationSheets);
                                i_message.Group = Groups.Group.Submissions;
                                slide.InsertChild(i_message);
                            }
                        }
                        //Lock the current sending.
                        this.LockSending();

                        // Send the message
                        this.m_Sender.Send(pres);
                    }
                }
            }
        }
Example #33
0
        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;
            }
        }
Example #34
0
 /// <summary>
 /// Signialisiert die Veränderung der Orientation-Eigenschaft.
 /// </summary>
 /// <param name="args"></param>
 protected virtual void OnOrientationChanged(PropertyEventArgs <Orientation> args)
 {
 }
 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;
             }
         }
 }
Example #36
0
 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;
         }
     }
 }
        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;
                }
            }
        }
 /// <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 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;
         }
     }
 }
        private void ResolutionWidthTextbox_TextChanged(Control sender, PropertyEventArgs<string> args)
        {
            settings.Set("Width", args.NewValue);

            optionsScreen.NeedRestart();
        }
Example #41
0
 public virtual void OnWroteProperty(object sender, PropertyEventArgs e)
 {
 }
Example #42
0
 /// <summary>
 /// Event handler that is invoked when the Drawing Attributes of the source sheet changes
 /// </summary>
 /// <param name="sender">The object that sent the message</param>
 /// <param name="args">The event arguments</param></param>
 private void HandleCurrentDrawingAttributesChanged(object sender, PropertyEventArgs args)
 {
     using (Synchronizer.Lock(this.m_SourceSheet.SyncRoot))
         using (Synchronizer.Lock(this.m_DestSheet.SyncRoot))
             this.m_DestSheet.CurrentDrawingAttributes = this.m_SourceSheet.CurrentDrawingAttributes;
 }
Example #43
0
 /// <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();
     }
 }
Example #44
0
 public virtual void OnLoadedProperty(object sender, PropertyEventArgs e)
 {
 }
        /// <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();
        }
Example #46
0
 private void HandleSheetChanged(object sender, PropertyEventArgs args)
 {
     // FIXME: Create an IUndoer to undo the change.
 }
Example #47
0
        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;
                        }
                    }
                }
            }
        }
Example #48
0
 protected abstract void HandleRoleChanged(object sender, PropertyEventArgs args);
Example #49
0
 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();
 }
Example #50
0
 public void HandleAdvancedChanged(object sender, PropertyEventArgs e)
 {
     UpdateAdvanced();
 }
Example #51
0
 private void OnShowIPChanged(object sender, PropertyEventArgs args)
 {
     using (Synchronizer.Lock(m_Model.ViewerState.SyncRoot)) {
         this.m_showIP = m_Model.ViewerState.ShowIP;
     }
     UpdateMessage();
 }
Example #52
0
 private void HandleRoleChanged(object sender, PropertyEventArgs args)
 {
     HandleRoleChangedHelper();
 }
Example #53
0
 protected virtual void OnSlot2MinSizeChanged(PropertyEventArgs<int?> args)
 {
 }
Example #54
0
 /// <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();
 }
Example #55
0
 protected virtual void OnSplitterSizeChanged(PropertyEventArgs<int> args)
 {
 }
Example #56
0
 private void HandleFilmStripAlignmentChanged(object sender, PropertyEventArgs e)
 {
     using (Synchronizer.Lock(this.m_Model.ViewerState.SyncRoot))
         this.Checked = (this.m_Model.ViewerState.FilmStripAlignment == this.m_DockStyle);
 }
Example #57
0
 /// <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);
     }
 }
Example #58
0
 private void HandleSSFilmStripWidthChanged(object sender, PropertyEventArgs e)
 {
     using (Synchronizer.Lock(this.m_Model.ViewerState.SyncRoot))
         this.Checked = (this.m_Model.ViewerState.SSFilmStripWidth == this.m_Width);
 }
Example #59
0
 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;
             }
         }
     }
 }
Example #60
0
        /// <summary>
        /// Handle the role changing
        /// </summary>
        /// <param name="sender">The event sender</param>
        /// <param name="args">The arguments</param>

        private void HandleRoleChanged(object sender, PropertyEventArgs args)
        {
            this.InitializeRole();
        }