回复 1楼Syainn的帖子
这是C1Calendar 和C1Schedule 之间的交互问题。
C1Calendar.SelectionChanged 事件由C1Schedle控件使用来导航。
同事应用的代码处理了事件和更新了C1Schedule。
方法混用。
建议改变LoadCalenderDataAccordingTimeSpan 方法。因此更新apppointments的时候会调用BeginInvoke(在C1Calendar和C1Schedule完成所有行为后执行),然后使用C1Schedule.BeginUpdate/EndUpdate方法避免额外的UI刷新操作。
代码参考:
- void LoadCalenderDataAccordingTimeSpan( DateTime[] Selection)
- {
- this.BeginInvoke((MethodInvoker)delegate() // delay appointments updates till Calendar and Scheduelr finish their navigation-related actions
- {
- c1Schedule1.BeginUpdate(); // suspend UI updates in Scheduler
- c1Schedule1.DataStorage.AppointmentStorage.Appointments.Clear();
- for (int i = 0; i < 3; i++)
- {
- Appointment ap = new Appointment();
- c1Schedule1.DataStorage.AppointmentStorage.Appointments.Add(ap);
- ap.Subject = "test";
- ap.Location = "testLocation";
- ap.Start = Convert.ToDateTime("2015-04-02");
- ap.End = Convert.ToDateTime("2015-04-03");
- ap.CustomData = "12345";
- ap.Links.Add(c1Schedule1.DataStorage.ContactStorage.Contacts[i]);
- }
- c1Schedule1.EndUpdate(); // resume Scheduler UI updates
- });
- }
复制代码 |