Hello,
I am populating the Gantt Chart with a data bus and I have managed to get data published to the chart, but I need the TaskAdded event to fire and it is not firing. I'm not sure why.
My binding class sets all the bindings in the load event, like this:
// Set the BindingContextControl property to reference this form this.ultraCalendarInfo1.DataBindingsForTasks.BindingContextControl = this; this.ultraCalendarInfo1.DataBindingsForProjects.BindingContextControl = this; // Set the DataSource and DataMember for Project and Tasks using the SetDataBinding method this.ultraCalendarInfo1.DataBindingsForProjects.SetDataBinding(MissionRepository.Instance.PlanRepo, "Plans"); this.ultraCalendarInfo1.DataBindingsForTasks.SetDataBinding(MissionRepository.Instance.PlanRepo, "Tasks"); // Set the DataBinding members for Projects this.ultraCalendarInfo1.DataBindingsForProjects.IdMember = "PlanGuid"; this.ultraCalendarInfo1.DataBindingsForProjects.KeyMember = "PlanID"; this.ultraCalendarInfo1.DataBindingsForProjects.NameMember = "PlanName"; this.ultraCalendarInfo1.DataBindingsForProjects.StartDateMember = "PlanStartTime"; // Set the DataBinding members for Tasks // Basic Task properties this.ultraCalendarInfo1.DataBindingsForTasks.NameMember = "TaskName"; this.ultraCalendarInfo1.DataBindingsForTasks.DurationMember = "TaskDuration"; this.ultraCalendarInfo1.DataBindingsForTasks.StartDateTimeMember = "TaskStartTime"; this.ultraCalendarInfo1.DataBindingsForTasks.IdMember = "TaskGuid"; this.ultraCalendarInfo1.DataBindingsForTasks.ProjectKeyMember = "PlanID"; this.ultraCalendarInfo1.DataBindingsForTasks.ParentTaskIdMember = "ParentTaskGuid"; this.ultraCalendarInfo1.DataBindingsForTasks.PercentCompleteMember = "TaskPercentComplete"; // All other properties this.ultraCalendarInfo1.DataBindingsForTasks.AllPropertiesMember = "AllProperties"; this.ultraGanttView1.CalendarInfo = this.ultraCalendarInfo1; Project project = new Project(); project.Key = MissionRepository.Instance.defaultProjectName; project.Name = MissionRepository.Instance.defaultProjectName; project.StartDate = DateTime.Now; this.ultraCalendarInfo1.Projects.Add(project); this.ultraGanttView1.Project = this.ultraGanttView1.CalendarInfo.Projects[1]; this.ultraGanttView1.CreationFilter = new CurrentDayIndicatorCreationFilter(); this.ultraGanttView1.GridAreaWidth = 400;
The binding's Designer code activates the TaskAdded handler:
this.ultraGanttView1.TaskAdded += new Infragistics.Win.UltraWinGanttView.TaskAddedHandler(this.ultraGanttView1_TaskAdded);
I see the new data on the gantt view, but the code never stops at the TaskAdded event. Any ideas on why this is happening?
Thanks,
Myca
Hello Myca,
Thanks a lot for verifying my answer.
Please, do not hesitate to contact me if you have any additional questions.
Thank you Atanas.
Thank you for the provided code snipped.
Based on it I have a suggestion why the issue you’ve got occurs in your project. It seems that you’re getting the data for the DataSet from a server using multi-thread operations. However, threads can be extremely tricky when DataBinding is concerned and the UltraGanttView in DotNet is not thread safe. I have created a simple sample based on the code you provided using a Timer in order to reproduce the behavior of the threads. As you can see neither the standard MS DataGridView is update because of the thread, in which the update happens. Please see attached zip. If your project behaves the same way please avoid using multi-threading.
If you're not using threads and the issue still occurs please create a working sample, so I could be able to investigate this on my own.
Hi Atanas,
I am running with MSVS 2008, so I'm only able to compare my code to yours visually, but I believe it is the same. The output from my program as I update the data repository appears to be managing parent Guids correctly according to these WriteLine statements:
Writing mission with guid: 89c04586-383d-4ff6-8721-3192f7a3aa98Aligned under null parent guid|--->Parent guid: 89c04586-383d-4ff6-8721-3192f7a3aa98, this guid: e0eb1b4b-ff5f-4714-98a0-d9d32b0f933d|------>Parent guid: e0eb1b4b-ff5f-4714-98a0-d9d32b0f933d this guid: 02bf89f3-7676-4bc5-b6d2-a165b9a93995|--->Parent guid: 89c04586-383d-4ff6-8721-3192f7a3aa98, this guid: a6a4bf31-fb5e-4344-be0f-c86a7d2bcef6|------>Parent guid: a6a4bf31-fb5e-4344-be0f-c86a7d2bcef6 this guid: 17fd1a03-d5a6-4205-8756-5fb6715a6f65|------>Parent guid: a6a4bf31-fb5e-4344-be0f-c86a7d2bcef6 this guid: 55ea48bf-0ba9-4831-8299-f6605cf0e0b6|------>Parent guid: a6a4bf31-fb5e-4344-be0f-c86a7d2bcef6 this guid: e333e080-7330-41d7-b1fe-1af5ecc03fab|--->Parent guid: 89c04586-383d-4ff6-8721-3192f7a3aa98, this guid: eb81f5c1-2525-4e9d-94f4-041b619b29b6|------>Parent guid: eb81f5c1-2525-4e9d-94f4-041b619b29b6 this guid: 30897af9-31b0-4223-b7a5-c55c572fccaf|------>Parent guid: eb81f5c1-2525-4e9d-94f4-041b619b29b6 this guid: a2d6595f-6458-479a-89c0-073db1485b1b
I am attaching what I am running. My BindingGantt class seems to be equivalent to your Form class, and my ProjectRepository seems to be the same as your GanttData. The COM_Component.OnDataReceived() methods are the places that write the data to the repository and that is where the logging is coming from. I'm missing whatever the difference is.
If you have bound the child tasks with the parent task properly in your underlaing data source, they should be indented automatically and the issue you’ve got should not occur. What I recommend is to check again if the parent’s ID is set properly in the child. I have modified my sample adding UltraGrid and bound it with the data source of the UltraGanttView. Please, pay attention how the parent’s ‘TaskID’ is set properly to the child’s ‘ParentTaskID’. Please see attached zip.
However, if you have bound the child tasks with parent task properly and the issue still occurs, please modify my sample in order to reproduce your issue, so I will be able to investigate this on my side.
I am waiting for your feedback.