예제 #1
0
 public void PopulateTasksWithoutThread(object taskObject) {
     Task TaskObject = (Task)taskObject;
     TaskButton TaskButtonObject = new TaskButton(ref TaskObject);
     TaskButtonObject.Width = TasksFlowPanel.Width - 30;
     TaskButtonObject.Height = 70;
     TaskButtonObject.Padding = new Padding(5, 5, 5, 5);
     TaskButtonObject.MouseClick += new MouseEventHandler(TaskButtonClick);
     TasksFlowPanel.Controls.Add(TaskButtonObject);
     if (TaskButtonList == null) TaskButtonList = new List<TaskButton>();
     TaskButtonList.Add(TaskButtonObject);
 }
예제 #2
0
 public void PopulateTasks(object taskObject) {
     try {
         if (TasksFlowPanel.InvokeRequired) TasksFlowPanel.Invoke((MethodInvoker)delegate { PopulateTasks(taskObject); });
         else {
             Task TaskObject = (Task)taskObject;
             TaskButton TaskButtonObject = new TaskButton(ref TaskObject);
             TaskButtonObject.Width = TasksFlowPanel.Width - 30;
             TaskButtonObject.Height = 70;
             TaskButtonObject.Padding = new Padding(5, 5, 5, 5);
             TaskButtonObject.MouseClick += new MouseEventHandler(TaskButtonClick);
             TasksFlowPanel.Controls.Add(TaskButtonObject);
             if (++TasksLoadedCount == NumberOfTasks) {
                 TaskButtonList = TasksFlowPanel.Controls.OfType<TaskButton>().Cast<TaskButton>().ToList();
                 SortByChangeEnabled(true);
                 SortByComboBox.SelectedIndex = 0;
             }
         }
     } catch {
         TasksFlowPanel.Invoke((MethodInvoker)delegate { PopulateTasks(taskObject); });
     }
 }