Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Save/Load not working (Read 12142 times)
jovi
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 8
Joined: Aug 12th, 2009
Save/Load not working
Aug 21st, 2009 at 3:11pm
Print Post  
Hi,

I was trying to make a test with the LoadFrom and SaveTo functions. I took the code from the "Resources" samples and add a SaveTo call at the end of the Load event of the form. Then I tried to load the info again and it seems to work, but I do not see it on the calendar component. Any ideas?

Here is the code for the load event of the form:

#if LOAD                        
           calendar1.LoadFrom(ApplicationPath + "settings.xml");
#else
               Contact contact1 = new Contact();
               Contact contact2 = new Contact();
               Contact contact3 = new Contact();

               contact1.FirstName = "Douglas";
               contact1.Id = "CNT42ACF69F-B960-01A7-0157-6C164E5C4880";
               contact1.LastName = "Clark";
               contact2.FirstName = "Jayna";
               contact2.Id = "CNT4B73E527-617A-3F7A-0128-00812F2A5735";
               contact2.LastName = "Silversteed";
               contact3.FirstName = "Joe";
               contact3.Id = "CNT7EC7F660-70EE-43E7-0232-A3F15CAF6C78";
               contact3.LastName = "Timberwood";

               calendar1.Contacts.Add(contact1);
               calendar1.Contacts.Add(contact2);
               calendar1.Contacts.Add(contact3);            

               Location _Location = new Location();
               _Location.Address = "3175 Av Cote de Liesse";
               _Location.Id = Guid.NewGuid().ToString();
               calendar1.Locations.Add(_Location);

           Appointment app = null;
           Random r = new Random();

           for (int i = 0; i < 20; i++)
           {
               app = new Appointment();
               app.StartTime = calendar1.Date + TimeSpan.FromDays(r.Next(10) + 3);
               app.EndTime = app.StartTime + TimeSpan.FromHours(24 + r.Next(24));
               app.HeaderText = "Resource " + i.ToString();
               app.Contacts.Add(calendar1.Contacts[r.Next(3)]);
               app.Location = calendar1.Locations[0];
               calendar1.Schedule.Items.Add(app);
           }

           calendar1.SaveTo(ApplicationPath + "settings.xml");
#endif
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Save/Load not working
Reply #1 - Aug 21st, 2009 at 4:03pm
Print Post  
Hi,

Does AplicationPath end with the path separator symbol? Could you check if there's any appointment data saved in settings.xml after SaveTo?

Stoyan
  
Back to top
 
IP Logged
 
jovi
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 8
Joined: Aug 12th, 2009
Re: Save/Load not working
Reply #2 - Aug 21st, 2009 at 4:08pm
Print Post  
Hi, thanks for your quick answer. Yes, all the appoitments, contacts and locations are there, and I can see them on the "watch" while debuggin in Visual Studio. I just can not see them on the component...  Embarrassed
  
Back to top
 
IP Logged
 
jovi
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 8
Joined: Aug 12th, 2009
Save/Load not working
Reply #3 - Aug 21st, 2009 at 5:18pm
Print Post  
I again. I realized that after loading, the calendar1.Schedule.Contacts collection has 3 elements, as expected, but calendar1.Contacts is empty. Is this the expected behaviour?
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Save/Load not working
Reply #4 - Aug 24th, 2009 at 6:15am
Print Post  
Hi,

Unfortunately, at this time the Calendar.SaveTo does not save view-specific information such as the resources selected for grouping. You have to manually reestablish this information upon loading.

Meppy
  
Back to top
 
IP Logged
 
mberger
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Jan 6th, 2009
Re: Save/Load not working
Reply #5 - Jan 12th, 2010 at 11:52am
Print Post  
Hi,

i have the same problem, Could  you please explain how i reesatblish this information?

greez Marco
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Save/Load not working
Reply #6 - Jan 12th, 2010 at 11:58am
Print Post  
Hi,

You need to add the resources you are grouping by to the corresponding Calendar collection - Contacts, Locations, Tasks or Resources. For example, if you were grouping by all available contacts, you would write something similar to the following:

Code
Select All
foreach (Contact contact in calendar.Schedule.Contacts)
      calendar.Contacts.Add(contact); 


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


I love YaBB 1G - SP1!

Posts: 44
Joined: Jan 6th, 2009
Re: Save/Load not working
Reply #7 - Jan 12th, 2010 at 12:17pm
Print Post  
Hi Meppy,

thanks for your help! But thats not the problem, because the resources that i have saved in a binary file will be added to the ResourceCollection of the Calendar. But the calendar doesn't display them...

regards Marco
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Save/Load not working
Reply #8 - Jan 12th, 2010 at 12:27pm
Print Post  
Can you post here the code you use for loading? Also, what view are you using?

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


I love YaBB 1G - SP1!

Posts: 44
Joined: Jan 6th, 2009
Re: Save/Load not working
Reply #9 - Jan 12th, 2010 at 1:16pm
Print Post  
I use the resourceView..., but i got it!!!

Thanks Meppy

Is it possible to set the width of the columns in the resourceview?
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Save/Load not working
Reply #10 - Jan 12th, 2010 at 1:44pm
Print Post  
You cannot set the width of the columns directly, the width is calculated based on the displayed text. You can however scale this width up and down through the ResourceViewSettings.TimelineScale property. The default value 100 specifies no scale.

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


I love YaBB 1G - SP1!

Posts: 44
Joined: Jan 6th, 2009
Re: Save/Load not working
Reply #11 - Jan 12th, 2010 at 3:08pm
Print Post  
Ok...,

but now i have an other little Problem. When i define a new Appointment with a duration of 1 day,
i got problems with the Item-Width. I have set the ResourceLengthMode to exact. If i reduce the size of the application window, the resource-width fills the calendar. if i enlarge the application window, the resource disappears.
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Save/Load not working
Reply #12 - Jan 12th, 2010 at 3:23pm
Print Post  
I am not quite sure what is the problem you are experiencing. Do you mean that the resource disappears or that the appointment disappears? Also, is this problem happening only when you modify the TimelineScale?

Sending me your Calendar settings and/or screenshots illustrating the problem might be helpful too. Feel free to send them to support@mindfusion.eu.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint