Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Autohandles troubles under certain conditions (Read 9734 times)
Amx
YaBB Newbies
*
Offline


digito ergo sum

Posts: 21
Joined: Jan 19th, 2010
Autohandles troubles under certain conditions
May 31st, 2010 at 1:58pm
Print Post  
Hi, I have this problem:

In a test situation with 2 Shape nodes (linked together) and 1 Container that contain one of the two Shapes, depending on drawing order of container/shape nodes, when I load the XML after saving It, sometimes I can't select the Shape contained in the Container.

I've tried to manually modify the Id of this unselectable Shape using "3" instead of "4" (because Container have Id=2), changing also crossing reference in container and link, and seems to work correctly.

Diagram.Behaviour is set to "Modify" and Diagram.ModificationStart is set to "AutoHandles"

I would post the xml but it's too long. May I send you by email?

Thanks in advance,
Amx
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Autohandles troubles under certain conditions
Reply #1 - May 31st, 2010 at 2:35pm
Print Post  
Hi,

Yes, please email it to support@mindfusion.eu.

Thanks,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Autohandles troubles under certain conditions
Reply #2 - May 31st, 2010 at 3:26pm
Print Post  
Hi,

What do you mean by this?

Quote:
The Xml object is purged from the presence of DiagramNodeAdapter nodes
("ControlNode", in Xml) that cannot be saved, and finally written in an Xml file.


Are you removing all <ControlNode> elements from the XmlDocument before saving it?

Stoyan
  
Back to top
 
IP Logged
 
Amx
YaBB Newbies
*
Offline


digito ergo sum

Posts: 21
Joined: Jan 19th, 2010
Re: Autohandles troubles under certain conditions
Reply #3 - May 31st, 2010 at 3:44pm
Print Post  
Stoyo wrote on May 31st, 2010 at 3:26pm:
Are you removing all <ControlNode> elements from the XmlDocument before saving it?
Stoyan


Yes, I remove every Node with Class="std:ControlNode" value and every Attachment in SubordinateGroup with ClassId="std:ControlNode".

I have made this because I use a UI Component that have no parameterless constructor (causing me crashes when I load Xml).
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Autohandles troubles under certain conditions
Reply #4 - May 31st, 2010 at 4:41pm
Print Post  
You can't just remove them - the ZIndex element value should correspond to a position in the Items collection when loading, or otherwise the ZIndex property setter won't work. I suppose you'll have to either add a no-args constructor, or also update the ZIndex elements in the XmlDocument before saving to a file. The ZIndex values should be consecutive numbers from 0 up to the number of items.

Stoyan
  
Back to top
 
IP Logged
 
Amx
YaBB Newbies
*
Offline


digito ergo sum

Posts: 21
Joined: Jan 19th, 2010
Re: Autohandles troubles under certain conditions
Reply #5 - May 31st, 2010 at 4:52pm
Print Post  
I have in mind the ZIndex updating before write file, but I've tried to change these values in original file MainDiagram.xml but with no effect.

Only changing ShapeNode progressive ID I noticed a positive result.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Autohandles troubles under certain conditions
Reply #6 - Jun 1st, 2010 at 8:09pm
Print Post  
We have ported a couple of events from our Silverlight component that could help you in this case. This version raises SerializeControl and DeserializeCotnrol control events you could handle to implement your own serialization code:
https://mindfusion.eu/_beta/wpfdiag233.zip

The handlers should look like this:

Code
Select All
private void OnSerializeControl(object sender, ControlNodeEventArgs e)
{
	e.Handled = true;
	e.Context.WriteString("sample", "Sample", e.XmlElement);
}

private void OnDeserializeControl(object sender, ControlNodeEventArgs e)
{
	e.Node.Control = new TextBox { Text = "sample" };
	e.Handled = true;
} 



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


digito ergo sum

Posts: 21
Joined: Jan 19th, 2010
Re: Autohandles troubles under certain conditions
Reply #7 - Jun 3rd, 2010 at 10:48am
Print Post  
I have implemented:

Code
Select All
diagram.DeserializeControl += new ControlNodeEventHandler(diagram_DeserializeControl);
diagram.SerializeControl += new ControlNodeEventHandler(diagram_SerializeControl);
//...
void diagram_SerializeControl(object sender, ControlNodeEventArgs e)
{
        e.Handled = true;
        e.Context.WriteString((e.Node.Control as MyCustomClass).MyCustomProperty, "BlockName", e.XmlElement);
}

void diagram_DeserializeControl(object sender, ControlNodeEventArgs e)
{
        e.Node.Control = new MyCustomClass(MyCustomParameter myParameter);
        e.Handled = true;
}
 



but, when I use Container nodes, the LoadFromXml method raise a ArgumentNullException: "parameter cannot be null: Parameter name: enumType".

I send you XML by email

Thanks,
Amx
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Autohandles troubles under certain conditions
Reply #8 - Jun 3rd, 2010 at 11:41am
Print Post  
Right, this version should fix that:
https://mindfusion.eu/_beta/wpfdiag233_ctrs.zip

Stoyan
  
Back to top
 
IP Logged
 
Amx
YaBB Newbies
*
Offline


digito ergo sum

Posts: 21
Joined: Jan 19th, 2010
Re: Autohandles troubles under certain conditions
Reply #9 - Jun 3rd, 2010 at 12:12pm
Print Post  
Ok, I've tested a little and works fine.

Thanks for your support,
Amx
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint