我尝试批量添加childtask,但是有以下报错,请问如何解决?
代码:
c1GanttView1.Tasks.Clear();
C1.Win.C1GanttView.Task task = new C1.Win.C1GanttView.Task();
task.Name = "Production";
task.PercentComplete = 0.40;
task.Start = new DateTime(2015, 06, 5);
task.Finish = new DateTime(2015, 06, 9);
task.Mode = TaskMode.Manual;
task.SetFieldValue("Length", 100.0);
task.SetFieldValue("SupportWidth", 200);
task.SetFieldValue("SectionalArea", 300);
task.SetFieldValue("ExcavationArea", 400);
task.SetFieldValue("ExcavationVolume", 500);
task.SetFieldValue("SupportAmount", 600);
task.SetFieldValue("SteelAmount", 700);
c1GanttView1.Tasks.Add(task);
List<C1.Win.C1GanttView.Task> ayList = new List<C1.Win.C1GanttView.Task>();
for (int i = 0; i < 100; i++)
{
C1.Win.C1GanttView.Task childTask = new C1.Win.C1GanttView.Task();
childTask.OutlineParent = task;
childTask.Name = "Production";
childTask.PercentComplete = 0.40;
childTask.Start = new DateTime(2015, 06, 5);
childTask.Finish = new DateTime(2015, 06, 9);
childTask.Mode = TaskMode.Manual;
childTask.SetFieldValue("Length", 100.0);
childTask.SetFieldValue("SupportWidth", 200);
childTask.SetFieldValue("SectionalArea", 300);
childTask.SetFieldValue("ExcavationArea", 400);
childTask.SetFieldValue("ExcavationVolume", 500);
childTask.SetFieldValue("SupportAmount", 600);
childTask.SetFieldValue("SteelAmount", 700);
ayList.Add(childTask);
}
c1GanttView1.Tasks.AddRange(ayList.ToArray());
报错:
|