Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Binary Serialization (Read 5137 times)
DaveB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Feb 11th, 2008
Binary Serialization
Feb 11th, 2008 at 4:59am
Print Post  
If have been trying for a couple of days to get the calender to serialize.

Is there an example of adding some items to the calender then binary serializing it?

Ive tried making my own custom appointment class like tutorial 4 but need an example of how to call the overloaded saveto and loadfrom methods.

Even better would be to have an example of
           
Calendar.Schedule.SaveTo(FileName, MindFusion.Scheduling.ContentType.Binary)

so that the Calender.Shedule can be serialized with everything thats inside it.

Any help will be greatly appreciated!

Dave


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


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Binary Serialization
Reply #1 - Feb 11th, 2008 at 7:11am
Print Post  
Here is a sample which demonstrates how to perform binary serialization and deserialization of custom items:

https://mindfusion.org/_samples/_sample_PlannerSerialization.zip

Meppy
  
Back to top
 
IP Logged
 
DaveB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Feb 11th, 2008
Re: Binary Serialization
Reply #2 - Feb 13th, 2008 at 5:01am
Print Post  
Thanks Meppy!

I have custom classes inheriting from Scheduling.Appointment working now.

I have been trying to figure out how to get classes to inherit from MindFusion.Scheduling.Item because it contains the Scheduling.TaskCollection and I want to have a list of Tasks for each item.

I have not been able to get an inherited class to work yet. I am using my custom classes for all of its sub classes and have added them all like:

       Schedule.RegisterItemClass(GetType(Projects.Appointment), "Projects.Appointment", 1)
       Schedule.RegisterItemClass(GetType(Projects.Contact), "Projects.Contact", 1)
       Schedule.RegisterItemClass(GetType(Projects.Location), "Projects.Location", 1)
       Schedule.RegisterItemClass(GetType(Projects.PurchaseOrder), "Projects.PurchaseOrder", 1)
       Schedule.RegisterResourceClass(GetType(Projects.Resource), "Projects.Resource", 1)
       Schedule.RegisterItemClass(GetType(Projects.ScheduleItem), "Projects.ScheduleItem", 1)
       Schedule.RegisterItemClass(GetType(Projects.Style), "Projects.Style", 1)
       Schedule.RegisterItemClass(GetType(Projects.Task), "Projects.Task", 1)
       UIMain.Calendar.InteractiveItemType = GetType(Projects.ScheduleItem)
       UIMain.Calendar.Visible = False


Is it possible or recomended to do it this way?

Would you be able to provide any example of this if it is recomended?

Another thing I noticed is when I tested the working Scheduling.Appointment custom classes , the only way they are displaying in Month view or MonthRange view is when the standard theme is being applied to the calender.

All the other themes only display items in the WeekRange mode.

Is there something that needs to be done to make this work in when not wanting to use the standard theme?

Thanks Dave

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


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Binary Serialization
Reply #3 - Feb 13th, 2008 at 6:11am
Print Post  
It is not necessary to derive directly from Item in order to take advantage of the Tasks collection. On the contrary, it is recommended to derive from Appointment which derives from Item and implements all of its abstract members and properties.

As for the items not visible in SingleMonth and MonthRange views, set the Calendar.MonthSettings.DaySettings.HeaderSize to a value other than 0 (which indicates that the headers should cover the entire cell).

Meppy
  
Back to top
 
IP Logged
 
DaveB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Feb 11th, 2008
Re: Binary Serialization
Reply #4 - Feb 14th, 2008 at 6:48am
Print Post  
[quote author=Meppy date=02/13/08 at 01:11:22]It is not necessary to derive directly from Item in order to take advantage of the Tasks collection. On the contrary, it is recommended to derive from Appointment which derives from Item and implements all of its abstract members and properties.

Thanks Meppy

I am almost there....I have trouble adding a task to an Appointment

I can't get at the tasks list in the Appointment base class

all I see is         

       UIMain.Calendar.Schedule.Tasks.Add(Task)

Can you show me an example of how this is done

I am looking for an Appointment object to have a list of tasks inside of it that I can add and remove from the Appointments tasks

I think this should be the last problem I have and then the rest should be easy

Thanks

Dave



  
Back to top
 
IP Logged
 
DaveB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Feb 11th, 2008
Re: Binary Serialization
Reply #5 - Feb 14th, 2008 at 6:53am
Print Post  
I should not forget to mention that both the Appointment and the Task classes are custom classes
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Binary Serialization
Reply #6 - Feb 14th, 2008 at 7:25am
Print Post  
The Item and Appointment classes allow only a single Task to be associated with them (through their Task property). If you need to attach more than one task at a time, you have to do this in your derived class.

Meppy
  
Back to top
 
IP Logged
 
DaveB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Feb 11th, 2008
Re: Binary Serialization
Reply #7 - Feb 14th, 2008 at 7:45am
Print Post  
I guess my problem is that I was not sure you could put a whole class inside a custom class because the way the reader works it seems that you can only have primitive fields for the deserialization to work

reader.ReadBoolean()
reader.ReadBytes()
etc.

I do this differently in my project by applying

    <Serializable(), _
   TypeConverter(GetType(ExpandableObjectConverter))> _
    Public Class Point

to most of my classes so that the serialization does everything without adding anymore code.

I guess I would just want to do something like

       Protected Friend TaskItems As New List(Of Project.Task)

in the custom Task class.....but its the way the writer and reader works that made me think you could just have simple primitive fields in these custom classes.

Do you know if you can do it this way?

Dave

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


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Binary Serialization
Reply #8 - Feb 14th, 2008 at 10:51am
Print Post  
I have created a small application that illustrates how to create custom appointments associated with more than one task at once. You can download it from here:

https://mindfusion.org/_samples/_sample_AppointmentWithManyTasks.zip

Meppy

P.S.: Just now I noticed you are using VisualBasic as a programming language and the sample above is in C#. Let me know if you are having any difficulties with it.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint