Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic how to add my property to Appintment (Read 5466 times)
hsun
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Jan 24th, 2006
how to add my property to Appintment
Jan 24th, 2006 at 1:28pm
Print Post  
planner.NET looks nice, but how I add my own property to Appointment? I need two my data in the Appointment class.

TQ
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: how to add my property to Appintment
Reply #1 - Jan 24th, 2006 at 2:01pm
Print Post  
In order to add custom data to an appointment, you need to create your own class derived from Appointment. You can add whatever additional properties you need to the derived class.

The sample below demonstrates how to do this.

Code
Select All
class MyAppointment : Appointment
{
  public MyAppointment()
  {
    customData = 5;
  }

  public int CustomData
  {
    get { return customData; }
    set { customData = value; }
  }

  private int customData;
}
 



Use the Calendar.InteractiveItemType property to specify that items from your class should be instantiated whenever the user creates items interactively. In this case you have to ensure that your class provides parameterless constructor as stated in the Planner.NET documentation.

I hope that helps
Stoyan
  
Back to top
 
IP Logged
 
hsun
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Jan 24th, 2006
Re: how to add my property to Appintment
Reply #2 - Jan 25th, 2006 at 4:03pm
Print Post  
thank man. I try it ...
  
Back to top
 
IP Logged
 
hsun
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Jan 24th, 2006
Re: how to add my property to Appintment
Reply #3 - Jan 25th, 2006 at 5:39pm
Print Post  
my data is not saved in the file, what I should to to save my own property in the method SaveTo of Schedule ?

Thank You
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: how to add my property to Appintment
Reply #4 - Jan 25th, 2006 at 6:21pm
Print Post  
To enable serialization of your custom items, register the item class for serialization by calling "Schedule.RegisterItemClass". Override the SaveTo and LoadFrom methods of the Appointment class and perform the necessary serialization/deserialization of the custom data there. Call the base class SaveTo and LoadFrom methods from your overrides so the Appointment class can serialize/deserialize its standard properties.

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