Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Losing my own properties in appoinment descendant (Read 5988 times)
Maxim
Guest


Losing my own properties in appoinment descendant
Apr 13th, 2006 at 7:30pm
Print Post  
I wrote my own descendant from Appontment like this:
Code
Select All
    public class EventItem : Appointment
    {
	  public EventItem():base()
	  {
		AllDayEvent = true;
	  }

	  private ContactRow _contactRow;
	  public ContactRow contactRow
	  {
		get
		{
		    return _contactRow;
		}
		set
		{
		    _contactRow = value;
		}
	  }
    }
 



I added new item that way:
Code
Select All
		EventItem item = new EventItem();
		item.Recurrence = GetRecurence();
		item.contactRow = ucCustomerSelector1.SelectedContact;
	    calendar.Schedule.Items.Add(item);
 



Everything works fine, but then I clicks one of events on calendar, I get item with contactRow==nulll!

Code
Select All
	  private void calendar_ItemClick(object sender, ItemMouseEventArgs e)
	  {
		if (e.Button == MouseButtons.Left && e.Clicks == 2)
		{
			   //(e.Item as EventItem).contactRow will be null here!
		}
	  }
 



How can I resolve this problem?
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Losing my own properties in appoinment descend
Reply #1 - Apr 14th, 2006 at 6:57am
Print Post  
This must be an oversight on our part. Custom appointments seem not to be completely consistent with recurrence in the current version of Planner.

I extended the Item interface to provide better recurrence support for custom items. You can download the preliminary build from here: https://mindfusion.org/_temp/_trial_Planner.NET.zip.

You should add a new override in your derived class as follows:

Code
Select All
protected override void CopyOccurrence(Item master)
{
  _contactRow = master.ContactRow;

  base.CopyOccurrence(master);
} 


Furthermore, you could add the following code in the setter of the ContactRow property.

Code
Select All
if (Recurrence != null)
  Recurrence.MarkException(this, false); 


This is to ensure that an item will be marked as exception when its ContactRow has changed.

I believe this would help.

Meppy
  
Back to top
 
IP Logged
 
Damian
Guest


Re: Losing my own properties in appoinment descend
Reply #2 - Apr 18th, 2006 at 3:22pm
Print Post  
I too have a similar problem - using the item modified event is fine until i add a recurrence item.  But after adding a recurrence if i try and drag an item on the calendar an use the e.item as my custom object all the properties are null.

I have tried to use the planner.zip files in this post but i get an error when i try to run the software now - saying -

Error1'The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'

  
Back to top
 
IP Logged
 
Damian
Guest


Re: Losing my own properties in appoinment descend
Reply #3 - Apr 18th, 2006 at 4:06pm
Print Post  
Ok - ive managed to suss out why i was getting the errors.

The manifest error was because of old entries in the license file licenses.licx - removed them and i was working again.

The properties missing from the item was because i was not checking the recurrence state and was trying to set it to e.item every time.  This is ok for normal items but for a recurrence i had to use the i.item.recurrence.master!

Its rather complicated how it all gangs together around recurrence and exceptions.  Im also storing the data in an SQL database so making sure i set everything ok is tricky.

Some better samples with recurrence would be nice rather than the ones to set multiple items in the tree.

Oh - also - the items in the zip attached create a bug in the control when if you click onto an appointment then click off it a white text box appears in the cell.  Didnt do this in the last version from what i remember.

  
Back to top
 
IP Logged
 
Damian
Guest


Re: Losing my own properties in appoinment descend
Reply #4 - Apr 18th, 2006 at 4:08pm
Print Post  
In last post - multiple items in the calendar not tree!!  Roll Eyes
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Losing my own properties in appoinment descend
Reply #5 - Apr 18th, 2006 at 8:35pm
Print Post  
I will be posting a complete example showing how to use recurring custom items without losing custom property values in the next few days. Check back soon and thanks for your patience.

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


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Losing my own properties in appoinment descend
Reply #6 - Apr 20th, 2006 at 8:17am
Print Post  
A sample demonstrating how to use recurrence with custom appointments can be downloaded from here: https://mindfusion.org/_samples/customapp.zip

The sample also includes a beta version of Planner 3.1 in its 'bin/Debug' directory.

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