Example #1
0
            protected override object SetUpMember(int index, object member)
            {
                Debug.Assert(!this.m_Parent.InvokeRequired);

                DisposableListViewItem item = new ClassroomListViewItem(this.m_Parent.m_EventQueue, (ClassroomModel)member);

                this.m_Parent.Items.Add(item);
                return(item);
            }
Example #2
0
                public ParticipantsSubItem(ClassroomListViewItem parent) : base(parent, null)
                {
                    this.m_Parent = parent;

                    Debug.Assert(this.m_Parent.Classroom != null);
                    // Note: the parent's classroom is immutable.
                    this.m_ParticipantsChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Parent.m_EventQueue,
                                                                                                  new PropertyEventHandler(this.HandleParticipantsChanged));
                    this.m_Parent.Classroom.Changed["Participants"].Add(this.m_ParticipantsChangedDispatcher.Dispatcher);
                    this.m_ParticipantsChangedDispatcher.Dispatcher(this.m_Parent.Classroom, null);
                }
Example #3
0
                public ProtocolSubItem(ClassroomListViewItem parent) : base(parent, null)
                {
                    this.m_Parent = parent;

                    Debug.Assert(this.m_Parent.Classroom != null);
                    // Note: the parent's classroom is immutable.
                    this.m_HumanNameChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Parent.m_EventQueue,
                                                                                               new PropertyEventHandler(this.HandleHumanNameChanged));
                    if (this.m_Parent.Classroom.Protocol != null)
                    {
                        this.m_Parent.Classroom.Protocol.Changed["HumanName"].Add(this.m_HumanNameChangedDispatcher.Dispatcher);
                    }
                    this.m_HumanNameChangedDispatcher.Dispatcher(this.m_Parent.Classroom, null);
                }
Example #4
0
        /// <summary>
        /// Handle an item being selected/de-selected
        /// </summary>
        /// <param name="e"></param>
        protected override void OnItemSelectionChanged(ListViewItemSelectionChangedEventArgs e)
        {
            base.OnItemSelectionChanged(e);

            if (m_IgnoreNextClassroomSelectionChanged)
            {
                m_IgnoreNextClassroomSelectionChanged = false;
                return;
            }

            // Ignore notifications from items which have not yet been added to the Items collection.
            // This is necessary since the control's handle will already have been created as items are being added.
            if (e.ItemIndex >= this.Items.Count)
            {
                return;
            }

            // Select the same item if we tried to select nothing
            if (cancelNextChange == true && e.IsSelected == false)
            {
                e.Item.Focused  = true;
                e.Item.Selected = true;
                // NOTE: We must already be connected because we were selected before
            }
            else
            {
                // Disconnect us or connect us to a different classroom
                ClassroomListViewItem item = ((ClassroomListViewItem)this.Items[e.ItemIndex]);
                bool connect = e.IsSelected;
                // Be careful to avoid a stack overflow by only changing when needed.
                // (Note: item.Classroom is an immutable property.)
                using (Synchronizer.Lock(item.Classroom.SyncRoot)) {
                    if (connect != item.Classroom.Connected)
                    {
                        item.Classroom.Connected = connect;
                    }
                }
            }
        }
Example #5
0
                public ProtocolSubItem(ClassroomListViewItem parent)
                    : base(parent, null)
                {
                    this.m_Parent = parent;

                    Debug.Assert(this.m_Parent.Classroom != null);
                    // Note: the parent's classroom is immutable.
                    this.m_HumanNameChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Parent.m_EventQueue,
                        new PropertyEventHandler(this.HandleHumanNameChanged));
                    if( this.m_Parent.Classroom.Protocol != null )
                        this.m_Parent.Classroom.Protocol.Changed["HumanName"].Add(this.m_HumanNameChangedDispatcher.Dispatcher);
                    this.m_HumanNameChangedDispatcher.Dispatcher(this.m_Parent.Classroom, null);
                }
Example #6
0
                public ParticipantsSubItem(ClassroomListViewItem parent)
                    : base(parent, null)
                {
                    this.m_Parent = parent;

                    Debug.Assert(this.m_Parent.Classroom != null);
                    // Note: the parent's classroom is immutable.
                    this.m_ParticipantsChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_Parent.m_EventQueue,
                        new PropertyEventHandler(this.HandleParticipantsChanged));
                    this.m_Parent.Classroom.Changed["Participants"].Add(this.m_ParticipantsChangedDispatcher.Dispatcher);
                    this.m_ParticipantsChangedDispatcher.Dispatcher(this.m_Parent.Classroom, null);
                }
Example #7
0
            protected override object SetUpMember(int index, object member)
            {
                Debug.Assert(!this.m_Parent.InvokeRequired);

                DisposableListViewItem item = new ClassroomListViewItem(this.m_Parent.m_EventQueue, (ClassroomModel) member);
                this.m_Parent.Items.Add(item);
                return item;
            }