示例#1
0
        public AssignmentListItem(Assignment assignment)
        {
            InitializeComponent();
            this.assignment = assignment;
            this.assignmentNameLabel.Text = assignment.title;
            this.groupNameLabel.Text      = assignment.group.name;

            //datetime panel
            datetime          = new DateRepresentationPanel(assignment.dateDue, 20.0f, 15.0f, 0);
            datetime.Location = new Point(550, 1);
            this.Controls.Add(datetime);
        }
示例#2
0
        public HomeworkListItem(HomeworkTabController tabController, Homework task, int bottomBorderWidth, bool bottomBorder) : base()
        {
            /// <summary>
            /// Constructor method for TaskListItem.
            /// </summary>
            this.tabController     = tabController;
            this.task              = task;
            this.bottomBorder      = bottomBorder;
            this.bottomBorderWidth = bottomBorderWidth;

            // Title Label
            titleLabel           = new LinkLabel();
            titleLabel.AutoSize  = true;
            titleLabel.Font      = new Font("Calibri", 20.0f, FontStyle.Bold);
            titleLabel.Location  = new Point(5, 0);
            titleLabel.Text      = task.title;
            titleLabel.BackColor = Color.Transparent;
            titleLabel.Click    += OnTitleLabelClick;
            this.Controls.Add(titleLabel);

            // Group Label
            groupLabel           = new Label();
            groupLabel.AutoSize  = true;
            groupLabel.Font      = new Font("Calibri", 15.0f);
            groupLabel.Location  = new Point(5, 35);
            groupLabel.Text      = task.group.name;
            groupLabel.BackColor = Color.Transparent;
            this.Controls.Add(groupLabel);

            // Description Label
            descriptionLabel           = new Label();
            descriptionLabel.AutoSize  = true;
            descriptionLabel.Font      = new Font("Calibri", 15.0f);
            descriptionLabel.Location  = new Point(300, 30);
            descriptionLabel.Text      = HomeworkListItem.ReduceText(task.description, 25);
            descriptionLabel.BackColor = Color.Transparent;
            this.Controls.Add(descriptionLabel);

            if (task.dateDue < DateTime.UtcNow && !task.hasCompleted)
            {
                overdueLabel           = new Label();
                overdueLabel.Text      = "Overdue!!!";
                overdueLabel.BackColor = Color.Red;
                overdueLabel.Font      = new Font("Calibri", 15.0f, FontStyle.Bold);
                overdueLabel.Location  = new Point(300, 0);
                overdueLabel.AutoSize  = true;
                overdueLabel.TextAlign = ContentAlignment.TopCenter;
                this.Controls.Add(overdueLabel);
            }

            // DateRepresentationPanel
            date           = new DateRepresentationPanel(task.dateDue, 30.0f, 20.0f, -20);
            date.Location  = new Point(650, 0);
            date.BackColor = Color.White;
            this.Controls.Add(date);

            // Done Checkbox
            doneButton           = new DoneButtonControl("Done?", startingState: this.task.hasCompleted);
            doneButton.AutoSize  = true;
            doneButton.Location  = new Point(550, 20);
            doneButton.BackColor = Color.Transparent;
            doneButton.AddButtonClickAction(this.OnDoneButtonClick);
            this.Controls.Add(doneButton);

            this.Height = date.Location.Y + date.Height + 15; //Height is changed relative to the lowest component to prevent UserControl taking up more space than necessary
        }