示例#1
0
        private void UpdateList()
        {
            listPanel.Controls.Clear();

            foreach (Academician ac in filteredAcList)
            {
                FlatUI.FlatLabel profileLabel = new FlatUI.FlatLabel();
                profileLabel.Text        = ac.Name + " - " + ac.Faculty + ", " + ac.Department;
                profileLabel.Tag         = ac.Id;
                profileLabel.Font        = labelFont;
                profileLabel.Margin      = labelPadding;
                profileLabel.AutoSize    = true;
                profileLabel.MouseEnter += ProfileLabel_MouseEnter;
                profileLabel.MouseLeave += ProfileLabel_MouseLeave;
                profileLabel.Click      += Profile_Click;

                FlatUI.FlatButton profileButton = new FlatUI.FlatButton();
                profileButton.Text   = "Özgeçmiş";
                profileButton.Tag    = ac.Id;
                profileButton.Size   = buttonSize;
                profileButton.Click += Profile_Click;

                FlatUI.FlatButton scheduleButton = new FlatUI.FlatButton();
                scheduleButton.Text   = "Ders Programı";
                scheduleButton.Tag    = ac.Id;
                scheduleButton.Size   = buttonSize;
                scheduleButton.Click += Profile_Click;

                listPanel.Controls.Add(profileLabel, 0, listPanel.RowCount - 1);
                listPanel.Controls.Add(profileButton, 1, listPanel.RowCount - 1);
                listPanel.Controls.Add(scheduleButton, 2, listPanel.RowCount - 1);
                listPanel.RowCount++;

                if (!facultyCB.Items.Contains(ac.Faculty))
                {
                    facultyCB.Items.Add(ac.Faculty);
                }

                if (!departmentCB.Items.Contains(ac.Department))
                {
                    departmentCB.Items.Add(ac.Department);
                }
            }
        }
示例#2
0
        /// <summary>
        /// This function will be called from data thread
        /// </summary>
        private void AddRowsToPanel()
        {
            foreach (Academician ac in acList)
            {
                FlatUI.FlatLabel profileLabel = new FlatUI.FlatLabel();
                profileLabel.Text        = ac.Name + " - " + ac.Faculty + ", " + ac.Department;
                profileLabel.Tag         = ac.Id;
                profileLabel.Font        = labelFont;
                profileLabel.Margin      = labelPadding;
                profileLabel.AutoSize    = true;
                profileLabel.MouseEnter += ProfileLabel_MouseEnter;
                profileLabel.MouseLeave += ProfileLabel_MouseLeave;
                profileLabel.Click      += Profile_Click;

                FlatUI.FlatButton profileButton = new FlatUI.FlatButton();
                profileButton.Text   = "Özgeçmiş";
                profileButton.Tag    = ac.Id;
                profileButton.Size   = buttonSize;
                profileButton.Click += Profile_Click;

                FlatUI.FlatButton scheduleButton = new FlatUI.FlatButton();
                scheduleButton.Text   = "Ders Programı";
                scheduleButton.Tag    = ac.Id;
                scheduleButton.Size   = buttonSize;
                scheduleButton.Click += Profile_Click;

                //We cant update UI from another thread. We have to be in UI thread.
                // We can achieve it by invoking an anonymous method.
                // See: https://stackoverflow.com/a/661662/7822421
                this.listPanel.Invoke((MethodInvoker) delegate {
                    // Running on the UI thread again
                    this.listPanel.Controls.Add(profileLabel, 0, listPanel.RowCount - 1);
                    //this.listPanel.Controls.Add(depLabel, 1, listPanel.RowCount - 1);
                    this.listPanel.Controls.Add(profileButton, 1, listPanel.RowCount - 1);
                    this.listPanel.Controls.Add(scheduleButton, 2, listPanel.RowCount - 1);
                    this.listPanel.RowCount++;
                });
            }
        }