Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Loading a big range of Resources (Read 2484 times)
thierry
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 11
Joined: Jun 3rd, 2010
Loading a big range of Resources
Feb 10th, 2011 at 2:01pm
Print Post  
Hi,

I load in the planner a big quantity of resources (aproximately 1000). On this big range of resources the Scheduler is very slow.

To load them, First I load the resources in the calendar.Schedule.Resources collections, then, I load my appointment in calendar1.Schedule.Items.

Finally (and it's the slowest section) I read all the calendar.Schedule.Resources collection to add the objects in calendar.Resources like this :

Code
Select All
calendar1.Resources.Add(calendar1.Schedule.Resources[i]); 



Do you know another way to load datas faster ?

To solve the time loading problem, I have tried to load the 30 First resources normally and the 970 next with an asynchronous thread. Like this :

Code
Select All
  void AddResources(int i) {
   if (!calendar1.InvokeRequired) {
    calendar1.Resources.Add(calendar1.Schedule.Resources[i]);
    if (i % 20 == 0) {
     calendar1.ResumeLayout();
     calendar1.SuspendLayout();
    }
   }
   else {
    calendar1.Invoke(new AddResourcesDelegate(AddResources), new object[] { i });
   }
  }
 



This Solution gives a best video result than the first one (the screen remains white during the 1000 loading datas in the first case) but, the scheduler keep a big rate of system resources, and even if I call just a messagebox the called form appears just after the 1000 datas are completely loaded.

How could I solve this problem ?

Best Regards,

Thierry
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Loading a big range of Resources
Reply #1 - Feb 10th, 2011 at 2:48pm
Print Post  
Wrap the initialization code in a BeginInit/EndInit block, as illustrated by the following sample:

Code
Select All
calendar1.BeginInit();
for (int i = 0; i < 1000; i++)
{
	Resource r = new Resource();
	r.Name = i.ToString();
	calendar1.Resources.Add(r);
	calendar1.Schedule.Resources.Add(r);
}
calendar1.EndInit(); 


The loading will be much faster, but the overall user experience with a calendar displaying thousand resources will be cumbersome.

Let me know if this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
thierry
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 11
Joined: Jun 3rd, 2010
Re: Loading a big range of Resources
Reply #2 - Feb 13th, 2011 at 11:50am
Print Post  
Hi,

Thanks, exactly what I want.

Best Regards,

Thierry
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint