Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Loading a diagram saved by the previous WinForms version (Read 5597 times)
bogdip
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 70
Joined: Sep 8th, 2008
Loading a diagram saved by the previous WinForms version
Nov 7th, 2014 at 12:44pm
Print Post  
Hello,

We have a lot of diagrams saved in the previous FlowChart.NET product and we want them to be ported to the new Wpf Diagram.

The diagram is loaded but the tables are invisible, only the links are shown.
I wanted to reproduce it in a test application but in the test app the diagram is not even loaded, a System.Format.Exception is thrown when running the line "diagram.LoadFromXml(doc);", where 'doc' is a document containing a diagram saved by the previous FlowChart.NET.

Please advise, what can be done to load an old diagram. What is this exception about?

Thanks,
Bogdan
« Last Edit: Nov 11th, 2014 at 1:43pm by bogdip »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Loading a diagram saved by the previous WinForms version
Reply #1 - Nov 7th, 2014 at 5:09pm
Print Post  
Hi,

The table in this file has its CustomDraw property set to Full, so you won't see it unless you handle the DrawNode event and draw something. If you don't want to use custom-drawing anymore, iterate over all tables after loading a file and reset CustomDraw:

Code
Select All
diagram.LoadFromXml(...);
foreach (var node in diagram.Nodes)
{
	var table = node as TableNode;
	if (table != null)
		table.CustomDraw = CustomDraw.None;
} 



The test application cannot parse your ReportDefinition tag; it will work if you copy the DeserializeTag handler from original application, or just set e.Handled = true from the handler to ignore.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
bogdip
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 70
Joined: Sep 8th, 2008
Re: Loading a diagram saved by the previous WinForms version
Reply #2 - Nov 10th, 2014 at 8:10am
Print Post  
Thanks, it works as the nodes are visible.

The next step is to reset their look to the default one (in order for our style to look proper when applied). I used the 'ClearStyleableProperties' but the table looks like they still have some non default properties values. The caption is not visible, the cell frame is thick and shifted to the right.
Also, the link heads are still colored even after I call link.ClearStyleableProperties.

Is there a simple way to reset the diagram item properties (and maybe the diagram properties also) to look as default, as when created with the button AddNode?

I've updated the sample,

Thanks,
Bogdan
« Last Edit: Nov 11th, 2014 at 1:20pm by bogdip »  

WPFMindFusionTest_001.rar (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Loading a diagram saved by the previous WinForms version
Reply #3 - Nov 11th, 2014 at 9:31am
Print Post  
Are the Practices.Composite.* assemblies referenced from the project a part of Microsoft Prism? I've installed the Prism package from nuget manager but can see only a Microsoft.Practices.Prism.Composition.dll assembly.
  
Back to top
 
IP Logged
 
bogdip
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 70
Joined: Sep 8th, 2008
Re: Loading a diagram saved by the previous WinForms version
Reply #4 - Nov 11th, 2014 at 10:03am
Print Post  
I attach the project with that assemblies removed as they were necessary for the DelegateCommand<object> class but for the current issue demo we don't need it.
« Last Edit: Nov 11th, 2014 at 1:18pm by bogdip »  

WPFMindFusionTest_002.rar (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Loading a diagram saved by the previous WinForms version
Reply #5 - Nov 11th, 2014 at 2:43pm
Print Post  
Quote:
The caption is not visible, the cell frame is thick and shifted to the right.


This seems to happen because the default MeasureUnit in WinForms version is set to Millimeter, then when you clear the properties you get default font size and pen thickness that's good only for the WpfPoint unit. In recent WinForms versions we have a ChangeUnit method that sets the unit and rescales size properties of items to match the new unit. If you have all WinForms files stored in same place, you could try doing one-time export that calls Load(), ChangeUnit(WpfPoint), Save(), then the sizes should be good for WpfDiagram's defaults. We'll also implement ChangeUnit for the current WpfDiagram release; then after loading a file whose MeasureUnit is Millimeter (i.e. coming from WinForms) you'd be able to call ChangeUnit(WpfPoint) to get nicer defaults.

Quote:
Also, the link heads are still colored even after I call link.ClearStyleableProperties.


We've omitted clearing the HeadStroke property from link's method. For time being you could also call link.ClearValue(DiagramLink.HeadStrokeProperty);

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
bogdip
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 70
Joined: Sep 8th, 2008
Re: Loading a diagram saved by the previous WinForms version
Reply #6 - Nov 12th, 2014 at 11:06am
Print Post  
Thanks, I appreciate your help,

I've called the ChangeUnit(MeasureUnit.WpfPoint) but then when loading the xml file in the Wpf diagram, all texts are missing (caption and cell texts) and the row heights got smaller.

Please advise, what should I do furthermore to load it correctly into the wpf diagram?

I'm attaching a test solution with two projects, first one is loading a WinForms diagram, change its MeasureUnit to WpfPoints, then save it.
The second project is loading this new WinForms diagram file into a Wpf diagram.

PS:A strange effect can be seen immediately after calling the ChangeUnit method on WinForms diagram.

Thanks,
Bogdan
  

ChangeMeasureUnitToWpfPointIssue.rar (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Loading a diagram saved by the previous WinForms version
Reply #7 - Nov 14th, 2014 at 9:34am
Print Post  
We've added ChangeUnit method to the WPF control here:
https://mindfusion.eu/_beta/wpfdiag.3.2.zip

Now calling it after loading a WinForms millimeters-unit file seems to produce same appearance as when adding new tables:

Code
Select All
diagram.LoadFromXml(doc);

if (diagram.MeasureUnit != GraphicsUnit.WpfPoint)
	diagram.ChangeUnit(GraphicsUnit.WpfPoint);

....

foreach(DiagramLink link in diagram.Links)
{
        link.ClearStyleableProperties();
	link.UpdateFromPoints();
} 



Links do not seem to repaint fully when we just call ClearValue on their properties, so also call UpdateFromPoints as above to repaint the clipped parts.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
bogdip
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 70
Joined: Sep 8th, 2008
Re: Loading a diagram saved by the previous WinForms version
Reply #8 - Nov 14th, 2014 at 3:37pm
Print Post  
Great, thanks!
  
Back to top
 
IP Logged
 
bogdip
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 70
Joined: Sep 8th, 2008
Re: Loading a diagram saved by the previous WinForms version
Reply #9 - Nov 25th, 2014 at 3:33pm
Print Post  
Hi Stoyan,

I just noticed the TableNode.RowHeight is not converted to WpfPoint after loading the WinForms diagram.

So, after calling the ChangeUnit(GraphicsUnit.WpfPoint), the tableNode.Rows[0].Height is 22.6771 but tableNode.RowHeight is left to 6. All rows have same height.

Can this be fixed too?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Loading a diagram saved by the previous WinForms version
Reply #10 - Nov 26th, 2014 at 11:35am
Print Post  
Hi,

This build should now convert RowHeight and ColumnWidth too:
https://mindfusion.eu/_beta/wpfdiag.3.2.zip

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
bogdip
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 70
Joined: Sep 8th, 2008
Re: Loading a diagram saved by the previous WinForms version
Reply #11 - Nov 28th, 2014 at 12:44pm
Print Post  
Thanks!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint