Page Index Toggle Pages: 1 [2]  Send TopicPrint
Hot Topic (More than 10 Replies) Import Wpf Diagram (Read 14009 times)
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Import Wpf Diagram
Reply #15 - Mar 30th, 2009 at 3:04pm
Print Post  
It's 916 KB when I download it. Could you try again using some download manager or a different browser?

Stoyan
  
Back to top
 
IP Logged
 
integragreg
YaBB Newbies
*
Offline



Posts: 40
Location: Tennessee
Joined: Jan 26th, 2009
Re: Import Wpf Diagram
Reply #16 - Mar 30th, 2009 at 3:06pm
Print Post  
I tried again, and got it this time. Thanks!
  
Back to top
WWW  
IP Logged
 
integragreg
YaBB Newbies
*
Offline



Posts: 40
Location: Tennessee
Joined: Jan 26th, 2009
Re: Import Wpf Diagram
Reply #17 - Mar 30th, 2009 at 6:42pm
Print Post  
Stoyan,

We saved a blank diagram using the Wpf components, and when we re-open it with DiagramLite, we get a null reference exception when calling the LoadFromXml() method.

Thanks,

Greg
  
Back to top
WWW  
IP Logged
 
integragreg
YaBB Newbies
*
Offline



Posts: 40
Location: Tennessee
Joined: Jan 26th, 2009
Re: Import Wpf Diagram
Reply #18 - Mar 30th, 2009 at 6:59pm
Print Post  
Sorry. False alarm. We weren't deserializing our tags.

It works fine.
  
Back to top
WWW  
IP Logged
 
integragreg
YaBB Newbies
*
Offline



Posts: 40
Location: Tennessee
Joined: Jan 26th, 2009
Re: Import Wpf Diagram
Reply #19 - Apr 6th, 2009 at 2:48pm
Print Post  
Stoyan,

The de-serialization of custom controls in DiagramLite seems to work okay for the first custom element that you encounter, but does not seem to work correctly for a second element.

Here's the repro:

We have a diagram with two custom controls inside the UIElement tag of two DiagramNodeAdapters. When we open it in DiagramLite, we handle the DeserializeControl as follows:

Code
Select All
e.Handled = true;


   var elt = e.XmlElement.Elements().First();


   MyControl ctl = MyControl.LoadFromXml(elt);


   e.Node.Control = ctl; 



We get a valid instance of our control back from our LoadFromXml() method in both cases. But later, when we try to access the second control instance using ControlNode.Control, we get an ArgumentException, saying that the specified argument was out of the range of valid values.

We've even tried inserting two ShapeNodes instead of MyControl in the DeserializeControl handler, and the same thing happens: we get the exception when we try to access the second control.


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Import Wpf Diagram
Reply #20 - Apr 6th, 2009 at 4:16pm
Print Post  
Do you mean there are two controls loaded successfully, but diagram.Nodes[1] throws an ArgumentException?
  
Back to top
 
IP Logged
 
integragreg
YaBB Newbies
*
Offline



Posts: 40
Location: Tennessee
Joined: Jan 26th, 2009
Re: Import Wpf Diagram
Reply #21 - Apr 6th, 2009 at 4:27pm
Print Post  
There are two controls that are loaded successfully, but the following code throws the exception in the "if" statement on the second node:

Code
Select All
foreach (ControlNode cn in diag.Nodes)
   {
   try
   {
   if (cn.Control != null && cn.Control is MyControl)
   {
   MyControl ctl =cn.Control as MyControl;
  ctl.RegisterForChildAlarms();
   ctl.SetParent(cn);
   }
   if (cn.Tag != null && cn.Tag is Diagram)
   {
   WireEvents(cn.Tag as Diagram);
   }
   }
   catch
   {
   continue;
   }

   }
 



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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Import Wpf Diagram
Reply #22 - Apr 7th, 2009 at 3:01pm
Print Post  
We could not reproduce this with our test control. Could you email us the xml file and a small project that shown how you are trying it load it?

Thanks you,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send TopicPrint