Esempio n. 1
0
        public ClassroomsListView(PresenterModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            this.m_EventQueue = new ControlEventQueue(this);
            this.m_Model      = model;

            this.View          = View.Details;
            this.FullRowSelect = true;
            this.GridLines     = true;
            this.Sorting       = SortOrder.None;
            this.CheckBoxes    = false;
            this.MultiSelect   = false;
            this.HideSelection = false;

            // TODO: Add icons for classrooms.
            // In the mean time, this serves to make the rows big enough to
            // be an easy target for a stylus.
            this.SmallImageList           = new ImageList();
            this.SmallImageList.ImageSize = new Size(1, 40);

            // Set the font for list view items
            this.Font = new Font(this.Font.FontFamily, this.Font.Size * 4 / 3);

            this.Columns.AddRange(new ColumnHeader[] { new ColumnHeader(), new ColumnHeader(), new ColumnHeader() });
            foreach (ColumnHeader column in this.Columns)
            {
                column.Width = -1;
            }
            this.Columns[0].Text = "Classrooms";
            this.Columns[1].Text = "Participants";
            this.Columns[2].Text = "Protocol";

            // Create a handle immediately so the ListViewItems can marshal event handlers to the creator thread.
            this.CreateHandle();

            // Add a default local classroom to the list
            defaultClassroomModel = new ClassroomModel(null, "Disconnected", ClassroomModelType.None);
            defaultClassroom      = new ClassroomListViewItem(this.m_EventQueue, defaultClassroomModel);
            this.Items.Add(defaultClassroom);
            defaultClassroom.Selected = true;


            // Set up a helper to add other classrooms
            this.m_ProtocolCollectionHelper = new ProtocolCollectionHelper(this, this.m_Model.Network);
        }
Esempio n. 2
0
            protected override void TearDownMember(int index, object member, object tag)
            {
                Debug.Assert(!this.m_Parent.InvokeRequired);
                DisposableListViewItem item = tag as DisposableListViewItem;

                if (item != null)
                {
                    //We don't want dynamic classrooms selection changed events to run when the classroom is removed from the UI because that
                    //might cause a connected client to be disconnected.  This hack is considered to be "ok for now" because the new
                    //UI design should make it go away.
                    m_Parent.m_IgnoreNextClassroomSelectionChanged = true;
                    item.Checked = false; //If we are checked when we try to remove a dynamic classroom it can except.
                    item.Remove();
                    item.Dispose();
                }
            }
Esempio n. 3
0
            protected override void TearDownMember(int index, object member, object tag)
            {
                Debug.Assert(!this.m_Parent.InvokeRequired);

                DisposableListViewItem item = tag as DisposableListViewItem;

                if (item != null)
                {
                    if (item.Selected)
                    {
                        this.m_Parent.Items[0].Focused  = true;
                        this.m_Parent.Items[0].Selected = true;
                    }

                    item.Remove();
                    item.Dispose();
                }
            }
Esempio n. 4
0
        public ClassroomsListView(PresenterModel model)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            this.m_EventQueue = new ControlEventQueue(this);
            this.m_Model = model;

            this.View = View.Details;
            this.FullRowSelect = true;
            this.GridLines = true;
            this.Sorting = SortOrder.None;
            this.CheckBoxes = false;
            this.MultiSelect = false;
            this.HideSelection = false;

            // TODO: Add icons for classrooms.
            // In the mean time, this serves to make the rows big enough to
            // be an easy target for a stylus.
            this.SmallImageList = new ImageList();
            this.SmallImageList.ImageSize = new Size(1, 40);

            // Set the font for list view items
            this.Font = new Font(this.Font.FontFamily, this.Font.Size * 4 / 3 );

            this.Columns.AddRange(new ColumnHeader[] { new ColumnHeader(), new ColumnHeader(), new ColumnHeader()});
            foreach(ColumnHeader column in this.Columns) column.Width = -1;
            this.Columns[0].Text = "Classrooms";
            this.Columns[1].Text = "Participants";
            this.Columns[2].Text = "Protocol";

            // Create a handle immediately so the ListViewItems can marshal event handlers to the creator thread.
            this.CreateHandle();

            // Add a default local classroom to the list
            defaultClassroomModel = new ClassroomModel( null, "Disconnected", ClassroomModelType.None );
            defaultClassroom = new ClassroomListViewItem( this.m_EventQueue, defaultClassroomModel );
            this.Items.Add( defaultClassroom );
            defaultClassroom.Selected = true;

            // Set up a helper to add other classrooms
            this.m_ProtocolCollectionHelper = new ProtocolCollectionHelper(this, this.m_Model.Network);
        }