public DeckNetworkService(SendingQueue sender, PresentationModel presentation, DeckModel deck)
        {
            this.m_Sender = sender;
            this.m_Presentation = presentation;
            this.m_Deck = deck;

            this.m_SlideRemovedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleSlideRemoved));
            this.m_SlideAddedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleSlideAdded));
            this.m_SlideContentAddedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleSlideContentAdded));
            this.m_DeckBackgroundColorChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleDeckBackgroundColorChanged));

            this.m_SlideNetworkServices = new Hashtable();

            this.m_TableOfContentsNetworkService = new TableOfContentsNetworkService(this.m_Sender, this.m_Presentation, this.m_Deck);

            // Lock the deck so no content can be added between registering the event listeners and calling SendAllSlidesAndContent().
            using( Synchronizer.Lock(this.m_Presentation.SyncRoot) ) {
                using(Synchronizer.Lock(deck.SyncRoot)) {

                    this.m_Deck.SlideRemoved += this.m_SlideRemovedDispatcher.Dispatcher;
                    this.m_Deck.SlideAdded += this.m_SlideAddedDispatcher.Dispatcher;
                    this.m_Deck.SlideContentAdded += this.m_SlideContentAddedDispatcher.Dispatcher;
                    this.m_Deck.Changed["DeckBackgroundColor"].Add(this.m_DeckBackgroundColorChangedDispatcher.Dispatcher);

                    this.SendAllSlidesAndContent(Group.AllParticipant);
                }
            }
        }
        /// <summary>
        /// Constructs a listener for changes to the deck traversal
        /// </summary>
        /// <param name="sender">The event queue for handling updates</param>
        /// <param name="presentation">The presentation</param>
        /// <param name="traversal">The deck traversal we care about </param>
        public DeckTraversalWebService(SendingQueue sender, PresentationModel presentation, DeckTraversalModel traversal)
        {
            this.m_Sender = sender;
            this.m_Presentation = presentation;
            this.m_DeckTraversal = traversal;

            // Create the deck object
            string deckName = "Untitled Deck";
            using (Synchronizer.Lock(this.m_DeckTraversal.SyncRoot))
            {
                using (Synchronizer.Lock(this.m_DeckTraversal.Deck))
                {
                    deckName = this.m_DeckTraversal.Deck.HumanName;
                }
            }
            SimpleWebDeck deck = new SimpleWebDeck();
            deck.Name = deckName;
            lock (WebService.Instance.GlobalModel) {
                WebService.Instance.GlobalModel.Decks.Add(deck);
            }
            WebService.Instance.UpdateModel();

            this.m_DeckWebService = new DeckWebService(this.m_Sender, this.m_Presentation, this.m_DeckTraversal.Deck);

            this.m_CurrentChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleCurrentChanged));
            this.m_DeckTraversal.Changed["Current"].Add(this.m_CurrentChangedDispatcher.Dispatcher);
        }
        private void StartEmptyPresentation()
        {
            // Make sure we have a suitable RoleModel for broadcasting a presentation.
            InstructorModel instructor;
            using(Synchronizer.Lock(this.m_Model.Participant.SyncRoot)) {
                instructor = this.m_Model.Participant.Role as InstructorModel;
                if(instructor == null) {
                    // Make the participant representing this user an Instructor,
                    // which tells the ConnectionManager to broadcast the presentation
                    // once it's added to the classroom.
                    instructor = new InstructorModel(Guid.NewGuid());
                    this.m_Model.Participant.Role = instructor;
                }
            }

            // Create the presentation.
            // TODO: Find something useful to use as the Presentation's HumanName.
            PresentationModel pres = new PresentationModel(Guid.NewGuid(), this.m_Model.Participant, "No presentation yet");

            using(Synchronizer.Lock(this.m_Model.Network.SyncRoot)) {
                // Associate the participant with itself.  This removes any existing association
                // (since an Instructor should not be processing broadcasts from other clients),
                // and also causes the NetworkAssociationService to copy anything we do to the
                // InstructorModel to the WorkspaceModel.
                this.m_Model.Network.Association = this.m_Model.Participant;
            }

            // Here's the kicker, which triggers the viewer to hide the classroom browser
            // and start displaying the presentation.  The NetworkAssociationService copies
            // the presentation to the WorkspaceModel, which causes it to be displayed by the UI.
            using(Synchronizer.Lock(instructor.SyncRoot)) {
                instructor.CurrentPresentation = pres;
            }
        }
        public PresentationRadioButton(ControlEventQueue dispatcher, PresentationModel presentation, StartupForm stup, PresentationsPanel parent, int i, ClassroomModel classroom)
        {
            this.m_EventQueue = dispatcher;
            this.m_Presentation = presentation;
            this.Tag = presentation.Owner;
            this.m_Startup = stup;
            this.Parent = parent;
            this.m_PresentationsPanel = parent;
            this.m_Classroom = classroom;
            this.Parent.Controls.Add(this);

            this.FlatStyle = FlatStyle.System;
            this.Font = Model.Viewer.ViewerStateModel.StringFont1;
            this.index = i;

            this.Location = new Point(10, (2*this.Font.Height) * (this.index + 1));
            this.Size = new Size(this.Parent.Width - 14, 2*this.Font.Height);

            //If the role changes we should remove ourself from our parent.
            this.m_ViewerStateRoleListener = new EventQueue.PropertyEventDispatcher(this.m_Startup.m_EventQueue,
                    new PropertyEventHandler(this.HandleViewerStateRoleChanged));
            this.m_Startup.m_Model.ViewerState.Changed["iRole"].Add(this.m_ViewerStateRoleListener.Dispatcher);

            this.m_HumanNameChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleHumanNameChanged));
            this.Presentation.Changed["HumanName"].Add(this.m_HumanNameChangedDispatcher.Dispatcher);
            this.m_HumanNameChangedDispatcher.Dispatcher(this.Presentation, null);
            this.CheckedChanged += new EventHandler(HandlePresentationSelectionChanged);

            this.m_ConnectedChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleConnectedChanged));
            this.m_Classroom.Changed["Connected"].Add(this.m_ConnectedChangedDispatcher.Dispatcher);
            this.HandleConnectedChanged(this.m_Classroom, null);
        }
        public TableOfContentsNetworkService(SendingQueue sender, PresentationModel presentation, DeckModel deck)
        {
            this.m_Sender = sender;
            this.m_Presentation = presentation;
            this.m_Deck = deck;

            this.m_EntriesCollectionHelper = new EntriesCollectionHelper(this);
        }
        public SSDeckTraversalNetworkService(SendingQueue sender, PresentationModel presentation, DeckTraversalModel traversal)
        {
            this.m_Sender = sender;
            this.m_Presentation = presentation;
            this.m_DeckTraversal = traversal;

            this.m_SSDeckNetworkService = new SSDeckNetworkService(this.m_Sender, this.m_Presentation, this.m_DeckTraversal.Deck);
        }
        public TextSheetNetworkService(SendingQueue sender, PresentationModel presentation, DeckModel deck, SlideModel slide, TextSheetModel sheet, SheetMessage.SheetCollection selector)
            : base(sender, presentation, deck, slide, sheet, selector)
        {
            this.sheet_ = sheet;

            this.sheet_.Changed["Text"].Add(new PropertyEventHandler(this.SendText));
            this.sheet_.Changed["Color"].Add(new PropertyEventHandler(this.SendText));
            this.sheet_.Changed["IsPublic"].Add(new PropertyEventHandler(this.SendPublic));
        }
 public SSSheetNetworkService(SendingQueue sender, PresentationModel presentation, DeckModel deck, SlideModel slide, SheetModel sheet, SheetMessage.SheetCollection selector)
 {
     this.m_Sender = sender;
     this.m_Presentation = presentation;
     this.m_Deck = deck;
     this.m_Slide = slide;
     this.m_Sheet = sheet;
     this.m_Selector = selector;
 }
        public SSInkSheetNetworkService(SendingQueue sender, PresentationModel presentation, DeckModel deck, SlideModel slide, InkSheetModel sheet, SheetMessage.SheetCollection selector)
            : base(sender, presentation, deck, slide, sheet, selector)
        {
            this.m_Sheet = sheet;

            this.m_Sheet.InkAdded += new StrokesEventHandler(this.HandleInkAdded);
            this.m_Sheet.InkDeleting += new StrokesEventHandler(this.HandleInkDeleting);

            this.SendExistingInk();
        }
        /// <summary>
        /// Construct a StudentPresentationNetworkService
        /// </summary>
        /// <param name="sender">The event queue to use</param>
        /// <param name="presentation">The PresentationModel to listen for changes to</param>
        public StudentPresentationNetworkService( SendingQueue sender, PresentationModel presentation )
        {
            this.m_Sender = sender;
            this.m_Presentation = presentation;

            this.m_StudentQuickPollNetworkService = new StudentQuickPollNetworkService( this.m_Sender, this.m_Presentation );

            this.m_StudentQuickPollChangedDispatcher = new EventQueue.PropertyEventDispatcher( this.m_Sender, new PropertyEventHandler( this.HandleStudentQuickPollChanged ) );
            this.m_Presentation.Changed["QuickPoll"].Add( this.m_StudentQuickPollChangedDispatcher.Dispatcher );
        }
        private bool m_ForcingStudentNavigationLock; // bool

        #endregion Fields

        #region Constructors

        public InstructorModel(Guid id)
            : base(id)
        {
            this.m_CurrentPresentation = null;
            this.m_CurrentDeckTraversal = null;
            this.m_CurrentQuickPoll = null;
            this.m_AcceptingStudentSubmissions = true;
            this.m_AcceptingQuickPollSubmissions = false;
            this.m_ForcingStudentNavigationLock = false;
        }
Example #12
0
        //public BroadcastSender(BroadcastMessage message) {
        public BroadcastSender(IPEndPoint serverEP, PresenterModel model, Guid serverID)
        {
            m_ServerEP = serverEP;
            m_Model = model;
            m_ServerID = serverID;
            m_Presentation = null;
            m_PresentationName = "Untitled Presentation";
            m_BufferSyncObject = new object();

            //The user can manually disable the broadcast for security/privacy reasons.
            m_Model.ViewerState.Changed["BroadcastDisabled"].Add(new PropertyEventHandler(OnBroadcastDisabledChanged));
            using (Synchronizer.Lock(m_Model.ViewerState.SyncRoot)) {
                m_BroadcastDisabled = m_Model.ViewerState.BroadcastDisabled;
            }

            //Get the initial Participant name. This probably never changes.
            m_Model.Participant.Changed["HumanName"].Add(new PropertyEventHandler(OnParticipantNameChanged));
            using (Synchronizer.Lock(m_Model.Participant.SyncRoot)) {
                m_ParticipantName = m_Model.Participant.HumanName;
            }

            m_Model.ViewerState.Changed["ShowIP"].Add(new PropertyEventHandler(OnShowIPChanged));
            using (Synchronizer.Lock(m_Model.ViewerState.SyncRoot)) {
               this.m_showIP = m_Model.ViewerState.ShowIP;
            }

            //Construct an initial broadcast message.
            UpdateMessage();

            //When OnPresentationChange occurs we will update the broadcast message and subscribe the HumanName property of the new
            //PresentationModel.  When the PresentationModel.HumanName changes we will also update the broadcast message.
            ThreadEventQueue eventQueue = new ThreadEventQueue();
            this.m_CurrentPresentationChangedDispatcher = this.m_Model.Workspace.CurrentPresentation.ListenAndInitialize(eventQueue, OnPresentationChanged);

            m_LocalAddress = GetLocalAddress();

            initSocket();

            //if init failed..
            if (m_Socket == null) {
                return;
            }

            /// Sending to either broadcast address works.  Probably we prefer IPAddress.Broadcast
            /// because this way one broadcast works for multiple interfaces, and it should
            /// also work on IPv6 networks.
            IPAddress broadcast = IPAddress.Broadcast; //this is 255.255.255.255 for ipv4.
            if (BroadcastManager.UseIPv6) {
                broadcast = BroadcastManager.IPv6LinkLocalMulticast;
            }
            m_BroadcastEP = new IPEndPoint(broadcast, BroadcastSender.ListenPort);

            m_SendThread = new Thread(new ThreadStart(SendThread));
            m_SendThread.Start();
        }
        /// <summary>
        /// Constructs a new QuickPollResultNetworkService
        /// </summary>
        /// <param name="sender">The message queue to use</param>
        /// <param name="presentation">The PresentationModel to associate this service with</param>
        /// <param name="poll">The QuickPollModel to associate this service with</param>
        /// <param name="result">The QuickPollResultModel to associate this service with</param>
        public QuickPollResultNetworkService( SendingQueue sender, PresentationModel presentation, QuickPollModel poll, QuickPollResultModel result )
        {
            this.m_Sender = sender;
            this.m_Presentation = presentation;
            this.m_QuickPoll = poll;
            this.m_Result = result;

            // Listen to changes tot he ResultString
            this.m_ResultChangedDispatcher = new EventQueue.PropertyEventDispatcher( this.m_Sender, new PropertyEventHandler( this.HandleResultChanged ) );
            this.m_Result.Changed["ResultString"].Add( this.m_ResultChangedDispatcher.Dispatcher );
        }
 public PresentationModel(Guid id, ParticipantModel owner, string humanName, bool isUntitledPresentation)
 {
     this.m_Id = id;
     this.m_DeckTraversals = new DeckTraversalCollection(this, "DeckTraversals");
     this.m_Participants = new ParticipantCollection(this, "Participants");
     this.m_Owner = owner;
     this.m_HumanName = humanName;
     this.m_QuickPoll = null;
     this.m_IsUntitledPresentation = isUntitledPresentation;
     CurrentPresentation = this;
 }
        public DeckTraversalNetworkService(SendingQueue sender, PresentationModel presentation, DeckTraversalModel traversal)
        {
            this.m_Sender = sender;
            this.m_Presentation = presentation;
            this.m_DeckTraversal = traversal;

            this.m_DeckNetworkService = new DeckNetworkService(this.m_Sender, this.m_Presentation, this.m_DeckTraversal.Deck);

            this.m_CurrentChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleCurrentChanged));
            this.m_DeckTraversal.Changed["Current"].Add(this.m_CurrentChangedDispatcher.Dispatcher);
        }
Example #16
0
 public PresentationModel(Guid id, ParticipantModel owner, string humanName, bool isUntitledPresentation)
 {
     this.m_Id                     = id;
     this.m_DeckTraversals         = new DeckTraversalCollection(this, "DeckTraversals");
     this.m_Participants           = new ParticipantCollection(this, "Participants");
     this.m_Owner                  = owner;
     this.m_HumanName              = humanName;
     this.m_QuickPoll              = null;
     this.m_IsUntitledPresentation = isUntitledPresentation;
     CurrentPresentation           = this;
 }
        /// <summary>
        /// Constructs a new StudentQuickPollNetworkService
        /// </summary>
        /// <param name="sender">The message queue to post messages to</param>
        /// <param name="presentation">The PresentationModel to create this class from</param>
        /// <param name="poll">The QuickPollModel to create this class from</param>
        public StudentQuickPollNetworkService( SendingQueue sender, PresentationModel presentation )
        {
            this.m_Sender = sender;
            this.m_Presentation = presentation;
            using( Synchronizer.Lock( this.m_Presentation.SyncRoot ) ) {
                this.m_QuickPoll = this.m_Presentation.QuickPoll;
            }

            if( this.m_QuickPoll != null ) {
                this.m_QuickPollResultCollectionHelper = new QuickPollResultCollectionHelper( this );
            }
        }
        public PresentationNetworkService(SendingQueue sender, PresentationModel presentation)
        {
            this.m_Sender = sender;
            this.m_Presentation = presentation;

            this.m_DeckTraversalsCollectionHelper = new DeckTraversalsCollectionHelper(this);

            this.m_QuickPollNetworkService = new QuickPollNetworkService( this.m_Sender, this.m_Presentation );

            this.m_QuickPollChangedDispatcher = new EventQueue.PropertyEventDispatcher( this.m_Sender, new PropertyEventHandler( this.HandleQuickPollChanged ) );
            this.m_Presentation.Changed["QuickPoll"].Add( this.m_QuickPollChangedDispatcher.Dispatcher );
        }
Example #19
0
        /// <summary>
        /// Construct a listener for a generic sheet
        /// </summary>
        /// <param name="sender">The event queue</param>
        /// <param name="presentation">The presentation</param>
        /// <param name="deck">The deck</param>
        /// <param name="slide">The slide</param>
        /// <param name="sheet">The sheet</param>
        /// <param name="selector">The collection that this is part of</param>
        public SheetWebService(SendingQueue sender, PresentationModel presentation, DeckModel deck, SlideModel slide, SheetModel sheet, SheetMessage.SheetCollection selector)
        {
            this.m_Sender = sender;
            this.m_Presentation = presentation;
            this.m_Deck = deck;
            this.m_Slide = slide;
            this.m_Sheet = sheet;
            this.m_Selector = selector;

            //            this.m_BoundsChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.Sender, new PropertyEventHandler(this.HandleBoundsChanged));
            //            this.m_Sheet.Changed["Bounds"].Add(this.m_BoundsChangedDispatcher.Dispatcher);
        }
        public SSSlideNetworkService(SendingQueue sender, PresentationModel presentation, DeckModel deck, SlideModel slide)
        {
            this.m_Sender = sender;
            this.m_Presentation = presentation;
            this.m_Deck = deck;
            this.m_Slide = slide;

            this.m_SubmissionStyleChangeDispatcher = new EventQueue.PropertyEventDispatcher( this.m_Sender, new PropertyEventHandler( this.HandleChange ) );
            this.m_Slide.Changed["SubmissionStyle"].Add( this.m_SubmissionStyleChangeDispatcher.Dispatcher );

            this.m_AnnotationSheetsCollectionHelper = new SSSheetsCollectionHelper(this, "AnnotationSheets", SheetMessage.SheetCollection.AnnotationSheets);
        }
        /// <summary>
        /// Construct the InkSheetWebService, this class listens for strokes to finish 
        /// and sends them across the network
        /// </summary>
        /// <param name="sender">The queue to use</param>
        /// <param name="presentation">The presentation model</param>
        /// <param name="deck">The deck model</param>
        /// <param name="slide">The slide model</param>
        /// <param name="sheet">The sheet model</param>
        /// <param name="selector">The sheet collection we are part of</param>
        public InkSheetWebService(SendingQueue sender, PresentationModel presentation, DeckModel deck, SlideModel slide, SheetModel sheet, SheetMessage.SheetCollection selector)
            : base(sender, presentation, deck, slide, sheet, selector)
        {
            // Keep track of our sheet
            this.m_Sheet = (InkSheetModel)sheet;

            // Get the slide ID
            using (Synchronizer.Lock(slide.SyncRoot)) {
                m_SlideID = slide.Id;
            }

            // Set Events
            this.m_Sheet.InkAdded += new StrokesEventHandler(this.HandleInkAdded);
            //            this.m_Sheet.InkDeleting += new StrokesEventHandler(this.HandleInkDeleting);
        }
Example #22
0
        /// <summary>
        /// Construct the service
        /// </summary>
        /// <param name="sender">The event queue</param>
        /// <param name="presentation">The presentation</param>
        /// <param name="deck">The deck</param>
        /// <param name="slide">The slide</param>
        public SlideWebService(SendingQueue sender, PresentationModel presentation, DeckModel deck, SlideModel slide)
        {
            this.m_Sender = sender;
            this.m_Presentation = presentation;
            this.m_Deck = deck;
            this.m_Slide = slide;

            this.m_ChangeDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleChange));
            this.m_Slide.Changed["Bounds"].Add(this.m_ChangeDispatcher.Dispatcher);
            this.m_Slide.Changed["Zoom"].Add(this.m_ChangeDispatcher.Dispatcher);
            this.m_Slide.Changed["BackgroundColor"].Add(this.m_ChangeDispatcher.Dispatcher);
            this.m_Slide.Changed["BackgroundTemplate"].Add(this.m_ChangeDispatcher.Dispatcher);

            this.m_ContentSheetsCollectionHelper = new SheetsCollectionHelper(this, "ContentSheets", SheetMessage.SheetCollection.ContentSheets);
            this.m_AnnotationSheetsCollectionHelper = new SheetsCollectionHelper(this, "AnnotationSheets", SheetMessage.SheetCollection.AnnotationSheets);
        }
        /// <summary>
        /// Build the network service
        /// </summary>
        /// <param name="sender">The message queue to use for these messages</param>
        /// <param name="presentation">The presentation to listen to changes to</param>
        public PresentationWebService( SendingQueue sender, PresentationModel presentation )
        {
            handler = new WebService.SSEventHandler(HandleStudentSubmission);
            WebService.Instance.SubmissionReceived += handler;
            qpHandler = new WebService.QPEventHandler(HandleQuickPollReceived);
            WebService.Instance.QuickPollReceived += qpHandler;

            this.m_Sender = sender;
            this.m_Presentation = presentation;

            this.m_DeckTraversalsCollectionHelper = new DeckTraversalsCollectionHelper(this);

            //            this.m_QuickPollWebService = new QuickPollWebService(this.m_Sender, this.m_Presentation);

            this.m_QuickPollChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleQuickPollChanged));
            this.m_Presentation.Changed["QuickPoll"].Add(this.m_QuickPollChangedDispatcher.Dispatcher);
        }
        public InkSheetNetworkService(SendingQueue sender, PresentationModel presentation, DeckModel deck, SlideModel slide, InkSheetModel sheet, SheetMessage.SheetCollection selector)
            : base(sender, presentation, deck, slide, sheet, selector)
        {
            this.m_Sheet = sheet;
            using (Synchronizer.Lock(slide.SyncRoot)) {
                m_SlideID = slide.Id;
            }

            this.m_Sheet.InkAdded += new StrokesEventHandler(this.HandleInkAdded);
            this.m_Sheet.InkDeleting += new StrokesEventHandler(this.HandleInkDeleting);

            Group receivers = Group.AllParticipant;
            if( (deck.Disposition & (DeckDisposition.StudentSubmission | DeckDisposition.QuickPoll)) != 0 ) {
                receivers = Group.Submissions;
            }

            this.SendExistingInk(receivers);
        }
        public RealTimeInkSheetNetworkService(SendingQueue sender, PresentationModel presentation, DeckModel deck, SlideModel slide, RealTimeInkSheetModel sheet, SheetMessage.SheetCollection selector)
            : base(sender, presentation, deck, slide, sheet, selector)
        {
            this.m_Sheet = sheet;

            using (Synchronizer.Lock(slide.SyncRoot)) {
                m_SlideID = slide.Id;
            }

            this.PacketBuffers = new Dictionary<int, List<int>>();
            this.PacketFlushTimes = new Dictionary<int, long>();

            this.m_CurrentDrawingAttributesChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.Sender, new PropertyEventHandler(this.HandleCurrentDrawingAttributesChanged));
            this.m_Sheet.Changed["CurrentDrawingAttributes"].Add(this.m_CurrentDrawingAttributesChangedDispatcher.Dispatcher);
            this.m_Sheet.StylusUp += new RealTimeInkSheetModel.StylusUpEventHandler(this.HandleStylusUp);
            this.m_Sheet.Packets += new RealTimeInkSheetModel.PacketsEventHandler(this.HandlePackets);
            this.m_Sheet.StylusDown += new RealTimeInkSheetModel.StylusDownEventHandler(this.HandleStylusDown);
        }
Example #26
0
        public SlideModel(Guid id, LocalId localId, SlideDisposition disposition, Rectangle bounds, Guid associationId)
            : this(id, localId, disposition, bounds)
        {
            this.m_AssociationId = associationId;

            //If this is a student submission, the associationID should be set.  In this case we
            //gather some extra information about the association slide and deck.
            if (!m_AssociationId.Equals(Guid.Empty))
            {
                PresentationModel pres = PresentationModel.CurrentPresentation;
                if (pres != null)
                {
                    PresentationModel.DeckTraversalCollection traversals;
                    traversals = pres.DeckTraversals;
                    foreach (DeckTraversalModel dtm in traversals)
                    {
                        DeckModel deck;
                        using (Synchronizer.Lock(dtm.SyncRoot)) {
                            deck = dtm.Deck;
                        }
                        Guid                 deckId;
                        DeckDisposition      deckDisp;
                        TableOfContentsModel toc;
                        using (Synchronizer.Lock(deck.SyncRoot)) {
                            deckId   = deck.Id;
                            deckDisp = deck.Disposition;
                            toc      = deck.TableOfContents;
                        }
                        TableOfContentsModel.Entry tocEntry = toc.GetEntryBySlideId(m_AssociationId);
                        if (tocEntry != null)
                        {
                            using (Synchronizer.Lock(tocEntry.SyncRoot)) {
                                m_AssociationSlideIndex = tocEntry.IndexInParent;
                            }
                            m_AssociationDeckDispostion = deckDisp;
                            m_AssociationDeckId         = deckId;
                            break;
                        }
                    }
                }
            }
        }
        public SSDeckNetworkService(SendingQueue sender, PresentationModel presentation, DeckModel deck)
        {
            this.m_Sender = sender;
            this.m_Presentation = presentation;
            this.m_Deck = deck;

            this.m_SlideRemovedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleSlideRemoved));
            this.m_SlideAddedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Sender, new PropertyEventHandler(this.HandleSlideAdded));

            this.m_SlideNetworkServices = new Hashtable();

            // Lock the deck so no content can be added between registering the event listeners and calling SendAllSlidesAndContent().
            using( Synchronizer.Lock(this.m_Presentation.SyncRoot) ) {
                using(Synchronizer.Lock(deck.SyncRoot)) {
                    this.m_Deck.SlideRemoved += this.m_SlideRemovedDispatcher.Dispatcher;
                    this.m_Deck.SlideAdded += this.m_SlideAddedDispatcher.Dispatcher;

                    this.AttachAllSlides();
                }
            }
        }
Example #28
0
        private void OnPresentationChanged(Property<PresentationModel>.EventArgs args)
        {
            //Remove old event handler if any
            if (this.m_Presentation != null) {
                this.m_Presentation.Changed["HumanName"].Remove(new PropertyEventHandler(OnPresentationNameChanged));
            }

            this.m_Presentation = args.New;

            //Update Presentation Name and add new event handler.
            if (m_Presentation != null) {
                using (Synchronizer.Lock(m_Presentation.SyncRoot)) {
                    m_PresentationName = m_Presentation.HumanName;
                }
                this.m_Presentation.Changed["HumanName"].Add(new PropertyEventHandler(OnPresentationNameChanged));
            }

            //Make a new broadcast message
            UpdateMessage();
        }
Example #29
0
 protected virtual void Dispose(bool disposing)
 {
     this.m_Disposed = true;
     if (disposing) {
         m_Model.ViewerState.Changed["BroadcastDisabled"].Remove(new PropertyEventHandler(OnBroadcastDisabledChanged));
         m_Model.Participant.Changed["HumanName"].Remove(new PropertyEventHandler(OnParticipantNameChanged));
         m_Model.ViewerState.Changed["ShowIP"].Remove(new PropertyEventHandler(OnShowIPChanged));
         this.m_CurrentPresentationChangedDispatcher.Dispose();
         if (m_Presentation != null) {
             m_Presentation.Changed["HumanName"].Remove(new PropertyEventHandler(OnPresentationNameChanged));
             m_Presentation = null;
         }
         if (m_Socket != null) {
             m_Socket.Close();
             m_Socket = null;
         }
     }
 }
Example #30
0
 /// <summary>
 /// Construct the appropriate sheet web service
 /// </summary>
 /// <param name="sender">The queue</param>
 /// <param name="presentation">The presentation</param>
 /// <param name="deck">The deck</param>
 /// <param name="slide">The slide</param>
 /// <param name="sheet">The sheet</param>
 /// <param name="selector">The sheet collection type</param>
 /// <returns>A sheet web service appropriate for the sheet model</returns>
 public static SheetWebService ForSheet(SendingQueue sender, PresentationModel presentation, DeckModel deck, SlideModel slide, SheetModel sheet, SheetMessage.SheetCollection selector)
 {
     if (sheet is InkSheetModel) {
         return new InkSheetWebService( sender, presentation, deck, slide, sheet, selector );
     } else {
         return new SheetWebService( sender, presentation, deck, slide, sheet, selector );
     }
 }
            public DeckTraversalsCollectionHelper(NetworkAssociationService service, PresentationModel source)
                : base(service.m_EventQueue, source, "DeckTraversals")
            {
                this.m_Service = service;
                this.m_Bucket = this.m_Service.m_Model.Workspace;

                base.Initialize();
            }
 public InstructorCurrentPresentationChangedMessage(PresentationModel presentation)
     : base(presentation)
 {
 }