コード例 #1
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); });
     }
 }
コード例 #2
0
 public void PopulateTasks(object taskObject)
 {
     try {
         if (TasksFlowPanel.InvokeRequired)
         {
             TasksFlowPanel.Invoke((MethodInvoker) delegate { PopulateTasks(taskObject); });
         }
         else
         {
             Task             TaskObject       = (Task)taskObject;
             TaskRunnerButton TaskButtonObject = new TaskRunnerButton(ref TaskObject);
             TaskButtonObject.Width   = TasksFlowPanel.Width - 30;
             TaskButtonObject.Height  = 70;
             TaskButtonObject.Padding = new Padding(5, 5, 5, 5);
             TasksFlowPanel.Controls.Add(TaskButtonObject);
             if (++TasksLoadedCount == TaskCount)
             {
                 OnTaskPopulated();
             }
         }
     } catch {
         TasksFlowPanel.Invoke((MethodInvoker) delegate { PopulateTasks(taskObject); });
     }
 }