async private void FormLoaded(object sender, EventArgs e) { /// <summary> /// Allows async code to be executed when starting the form. This is async to prevent blocking of the UI thread. /// </summary> Homework[] tasks = await APIHandler.GetHomework(student : user); // HomeworkTabController tabController = new HomeworkTabController(tasks); tabController.Location = new Point(10, 56); tabController.Font = new Font("Calibri", 12.0f); tabController.SelectedIndex = 0; tabController.Size = new Size(740, 395); this.Controls.Add(tabController); loadingLabel.Hide(); progressBar.Hide(); label3.Hide(); label1.Show(); label2.Show(); alpsLabel.Show(); nameLabel.Show(); refreshButton.Show(); menuStrip1.Show(); }
public HomeworkTabPage(HomeworkTabController parent, bool containsCompletedTasks, CustomList taskData, int taskBorderWidth) { this.containsCompletedTasks = containsCompletedTasks; if (containsCompletedTasks) { this.titleText = "Completed tasks"; } else { this.titleText = "Uncompleted tasks"; } this.data = taskData; this.parent = parent; this.AutoScroll = true; this.BorderStyle = BorderStyle.FixedSingle; FillTabPage(); //https://stackoverflow.com/questions/5489273/how-do-i-disable-the-horizontal-scrollbar-in-a-panel this.AutoScroll = false; this.HorizontalScroll.Visible = false; this.HorizontalScroll.Enabled = false; this.HorizontalScroll.Maximum = 0; this.AutoScroll = true; }
public RemoveTabButton(FocussedTaskTab parentTab, HomeworkTabController tabController) : base() { this.BackColor = Color.White; this.AutoSize = true; this.tabController = tabController; this.parentTab = parentTab; this.FlatStyle = FlatStyle.Flat; this.FlatAppearance.BorderSize = 0; this.Cursor = Cursors.Hand; this.BackgroundImage = global::Trackr.Properties.Resources.blackCross; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.Size = new Size(60, 60); }
public FocussedTaskTab(Homework task, HomeworkTabController tabController, Feedback feedback = null) : base() { this.tabController = tabController; this.task = task; this.feedback = feedback; this.Text = this.task.title; this.BorderStyle = BorderStyle.FixedSingle; // Add border // Title label titleLabel = new Label(); titleLabel.AutoSize = true; titleLabel.Font = new Font("Calibri", 18.0f, FontStyle.Bold); titleLabel.Location = new Point(10, 0); titleLabel.Text = task.title; titleLabel.BackColor = Color.Transparent; this.Controls.Add(titleLabel); // Group label groupLabel = new Label(); groupLabel.AutoSize = true; groupLabel.Font = new Font("Calibri", 14.0f); groupLabel.Location = new Point(10, 30); groupLabel.Text = "• Class: " + task.group.name; groupLabel.BackColor = Color.Transparent; this.Controls.Add(groupLabel); // Group subject label groupSubjectLabel = new Label(); groupSubjectLabel.AutoSize = true; groupSubjectLabel.Font = new Font("Calibri", 14.0f, FontStyle.Italic); groupSubjectLabel.Location = new Point(10, 55); groupSubjectLabel.Text = "• Subject: " + task.group.subject; groupSubjectLabel.BackColor = Color.Transparent; this.Controls.Add(groupSubjectLabel); // Due-in label dueInLabel = new Label(); dueInLabel.AutoSize = true; dueInLabel.Font = new Font("Calibri", 18.0f, FontStyle.Underline); dueInLabel.Location = new Point(300, 0); dueInLabel.Text = "Due in: " + task.dateDue.ToString("d MMMM yyyy"); dueInLabel.BackColor = Color.Transparent; this.Controls.Add(dueInLabel); // Task description label taskDescriptionLabel = new Label(); taskDescriptionLabel.AutoSize = true; taskDescriptionLabel.Font = new Font("Calibri", 14.0f); taskDescriptionLabel.Location = new Point(10, 90); taskDescriptionLabel.Text = task.description; taskDescriptionLabel.BackColor = Color.Transparent; taskDescriptionLabel.MaximumSize = new Size(650, 200); this.Controls.Add(taskDescriptionLabel); // Remove tab button removeTab = new RemoveTabButton(this, tabController); removeTab.AutoSize = true; removeTab.Location = new Point(650, 5); this.Controls.Add(removeTab); // Remove tab label removeTabLabel = new Label(); removeTabLabel.Text = "Remove tab"; removeTabLabel.AutoSize = true; removeTabLabel.Location = new Point(638, 69); removeTabLabel.BackColor = Color.Transparent; this.Controls.Add(this.removeTabLabel); if (this.feedback.Exists()) { feedbackPanel = new FeedbackPanel(this.feedback); feedbackPanel.Location = new Point(10, 215); feedbackPanel.Width = tabController.Size.Width; this.Controls.Add(feedbackPanel); } }
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 }