Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) Moving to the Flowchart.NET 5 API (Read 10216 times)
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3169
Joined: Oct 19th, 2005
Moving to the Flowchart.NET 5 API
Jul 18th, 2007 at 8:43am
Print Post  
We are ready with everything for the Flowchart.NET 5 release, except for the help file. We have overwhelmed our technical writer with all the changes, so we can't start beta tests for at least a couple of weeks more. Anyway those of you who wish to move to the new version can already do so. The version 5 dlls and ported sample projects are here -

https://mindfusion.org/_beta/fcnet5.zip

The current beta builds of the control assemblies are quite stable, though we don't recommend them for production use before the beta tests end. If you don't need to release your applications in the next few months, please try the new dlls.

I'll post below a short guide explaining how to port your Flowchart.NET 4 -based projects to the new API. We have successfully followed these steps while porting the 50 or so Flowchart.NET sample projects. If you have any questions related to this, please post them in the same thread.

g.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3169
Joined: Oct 19th, 2005
Replacing FlowChart with Diagram + DiagramView
Reply #1 - Jul 18th, 2007 at 8:54am
Print Post  
1. Open your project.

2. Close all forms.

3. Remove Flowchart.net.dll from the project references list.

4. Open the form that contains the FlowChart control in the code editor (use the View Code from the form file context menu).

5. Find and remove the declaration of the Flowchart member field from the form.

6. Go to the form's InitializeComponent method.

7. Remove the FlowChart constructor call.

8. Select and cut to the clipboard the FlowChart instance initialization code found in InitializeComponent.

9. Paste the initialization code into a text file.

10. Remove the Controls.Add call that adds the FlowChart instance to the form.

11. Save the form code file.

12. Now you can open the form in design mode. Do so.

13. Add the MindFusion.Diagramming.dll and MindFusion.Diagramming.WinForms.dll to the toolbox.

14. Drag a Diagram from the toolbox to the form.

15. In the property browser rename the Diagram instance so that it has the same name as the old FlowChart instance.

16. Drag a DiagramView from the toolbox to the form.

17. Select the DiagramView and in the property browser select the Diagram property, drop down the combo box and select the Diagram instance you have added above. If the combo box is empty, close the form and open it again so VS can find the Diagram instance.

18. Rebuild the project - there might be a few hundred compilation errors, depending on how much of the Flowchart.NET API you are using.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3169
Joined: Oct 19th, 2005
Fixing build errors
Reply #2 - Jul 18th, 2007 at 9:00am
Print Post  
Probably the first error reported will state "Could not transform licenses file 'licenses.licx' into a binary resource.  (1) : error LC0003". Double click it to open the licenses.licx file. Replace the"MindFusion.Diagramming.WinForms.FlowChart, FlowChart.NET" string there with "MindFusion.Diagramming.WinForms.DiagramView, MindFusion.Diagramming.WinForms". Make sure the PublicKeyToken value at the end of the line is set to null.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3169
Joined: Oct 19th, 2005
Fixing build errors
Reply #3 - Jul 18th, 2007 at 9:12am
Print Post  
Next, fix the "type XYZ not found" errors.

Many types have been moved from the MindFusion.Diagramming.WinForms namespace to MindFusion.Diagramming. Add an using/imports MindFusion.Diagramming directive at the top of the file, or remove the "WinForms" part where necessary if you prefer using fully-qualified type names.

A good way to quickly fix these errors is to use the Replace in Files command, with the "Whole word" and "Case sensitive" options enabled. These are the most commonly used FlowChart.NET types that have been renamed:

ChartObject -> DiagramItem
Arrow -> DiagramLink
Node -> DiagramNode
Box -> ShapeNode
Table -> TableNode
ControlHost -> ControlNode
ShapeTemplate -> Shape

I'll post a more detailed table below. For now leave EventArgs-related class names alone.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3169
Joined: Oct 19th, 2005
Event handlers
Reply #4 - Jul 18th, 2007 at 9:24am
Print Post  
If you are using C#, open your saved InitializeComponent method code and find all += operators that add event handlers. For each handler there, add a new one by double clicking the respective new event in the property browser.

If you are using VB.NET, find all "Handles FlowChart." something declarations, which denote event handlers. For each handler, create a new one by selecting the respective new event in the top-right combo box in the code window.

The Arrow* events are renamed to Link*. Now there is a single set of events raised for all types of nodes., so for Box*, Table* or Control* events, create the respective Node* event. Once you create the new event handler, move the code from the old event method to the new one, and delete the old method. For node related events, use reflection to find out if "e.Node" is a ShapeNode, TableNode or ControlNode and place the code from the old handlers in the respective "if" block.

The validation events now follow the .NET convention of providing a Cancel argument. Replace all "e.Confirm = false" statements with the respective "e.Cancel = true", or vice versa.

Rebuild again to get a list of errors related (mostly) to renamed properties and methods.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3169
Joined: Oct 19th, 2005
FlowChart.CreateXYZ methods
Reply #5 - Jul 18th, 2007 at 9:39am
Print Post  
There aren't Diagram.CreateXYZ() methods, but there are Diagram.Factory.CreateXYZ() ones.

This is the recommended way to create items now:

ShapeNode node = new ShapeNode();
node.Bounds = new RectangleF(...);
node.Shape = Shapes.Rectangle;
diagram.Nodes.Add(node);

This makes it possible to use the same code for creating instances of custom node or link types. Though if you are using the standard types, you can still use the diagram.Factory methods for brevity.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3169
Joined: Oct 19th, 2005
Property name related build errors
Reply #6 - Jul 18th, 2007 at 9:57am
Print Post  
Most of the rest of build errors can be fixed by following these rules:

Most property name changes are related to the changed class names. E.g. BoxBrush is now called ShapeBrush, ArrowStyle is now called LinkStyle, etc; so you can fix errors where you see Arrow or Box used in property names by replacing them with Link or Shape.

Other changes are related to removing abbreviations, e.g. CurrScrollRow is now called CurrentScrollRow, DestAnchor is DestinationAnchor. So if you see an error related to an abbreviated property name, the chance is that replacing it with the full word form will fix the error.

Other notable changes are listed below:

FlowChart.DocExtents -> Diagram.Bounds
ChartObject.BoundingRect -> DiagramItem.Bounds
Arrow.ArrowBase -> DiagramLink.BaseShape
Arrow.ArrowHead -> DiagramLink.HeadShape
Arrow.IntermArrowHead -> DiagramLink.IntermediaryShape

Box.Style have been removed -> now use ShapeNode.Shape; the ShapeNode nodes functionality corresponds to that of boxes whose style was set to BoxStyle.Shape

PenWidth,PenColor,PenDashStyle have been removed -> use the Pen property

FillColor has been removed -> use the Brush property
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3169
Joined: Oct 19th, 2005
Methods
Reply #7 - Jul 18th, 2007 at 10:08am
Print Post  
There aren't FindBox, FindTable, FindControlHost methods, but just FindNode. You must use refection to determine what type of node has been found. The same goes for GetBoxAt, GetTableAt, GetControlHostAt -> now there is GetNodeAt method.

The FitSizeToBox/Text methods have been renamed to ResizeToFitBox.Text. The FlowChart.FitObjsToDoc is now called Diagram.ResizeToFitItems.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3169
Joined: Oct 19th, 2005
XML serializaton
Reply #8 - Jul 18th, 2007 at 10:10am
Print Post  
The XmlWriter and XmlReader classes have been removed. Now there are Diagram.SaveToXml and Diagram.LoadFromXml methods. The XML format has been redesigned entirely in order to support custom item types. LoadFromXml can load XML files saved by older Flowchart.NET versions as well.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3169
Joined: Oct 19th, 2005
for-each loops
Reply #9 - Jul 18th, 2007 at 10:13am
Print Post  
replace loops of this kind -

foreach (Box b in flowchart.Boxes)
{
  ...
}

with

foreach (DiagramNode n in diagram.Nodes)
{
  ShapeNode b = n as ShapeNode;
  if (b == null)
    continue;
  ...
}
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3169
Joined: Oct 19th, 2005
Miscellaneous controls
Reply #10 - Jul 18th, 2007 at 10:18am
Print Post  
The ShapeToolbar.Document property has been removed. Now you can handle the ShapeToolbar.ShapeSelected event in order to change the default shape in a specific Diagram instance, or the Shape of a selected ShapeNode instance. Drag-and-drop from ShapeToolbar is now done using the left mouse button.

The Overview control is now associated with a DiagramView instance. The Overview.Document property is now OverView.DiagramView.

Other miscellaneous components that had a Document property of type FlowChart, now have a Diagram property of type Diagram.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3169
Joined: Oct 19th, 2005
FlowChart, WebChart, Diagram / DiagramView
Reply #11 - Jul 18th, 2007 at 10:24am
Print Post  
The behavior, mouse cursor, printing and clipboard related properties and methods are now members of the DiagramView class, either because they are used mostly for interaction, or because they reference System.Windows.Forms.

The Diagram class contains the diagram data and some default-value properties. The MindFusion.Diagramming.dll where Diagram is defined can be used instead of the Webchart.dll in the WebApp sample scenario, since it does not reference Windows Forms. Webchart.dll is not supported anymore.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3169
Joined: Oct 19th, 2005
FlowChart members moved to Diagram
Reply #12 - Jul 27th, 2007 at 5:23am
Print Post  
Old name New name
ActiveMnpColor ActiveItemHandlesColor
ActiveObject ActiveItem
AlignPointToGrid AlignPointToGrid
AlignToGrid AlignToGrid
AllowLinksRepeat AllowLinksRepeat
AllowRefLinks AllowSelfLoops
AllowSplitArrows AllowSplitLinks
AllowUnanchoredArrows AllowUnanchoredLinks
AllowUnconnectedArrows AllowUnconnectedLinks
ArrowBase LinkBaseShape
ArrowBaseSize LinkBaseShapeSize
ArrowBrush LinkBrush
ArrowCascadeOrientation LinkCascadeOrientation
ArrowCrossings LinkCrossings
ArrowCustomDraw LinkCustomDraw
ArrowEndsMovable LinkEndsMovable
ArrowHandlesStyle LinkHandlesStyle
ArrowHead LinkHeadShape
ArrowHeadSize LinkHeadShapeSize
ArrowIntermSize LinkIntermediateShapeSize
ArrowPen LinkPen
Arrows Links
ArrowSegments LinkSegments
ArrowsRetainForm LinksRetainForm
ArrowsSnapToBorders LinksSnapToBorders
ArrowStyle LinkStyle
ArrowText LinkText
ArrowTextStyle LinkTextStyle
AutoSizeDoc AutoResize
BackBrush BackBrush
BackgroundImage BackgroundImage
BkgrImagePos BackgroundImageAlign
BoxBrush ShapeBrush
BoxCustomDraw ShapeCustomDraw
Boxes Nodes
BoxesExpandable NodesExpandable
BoxHandlesStyle ShapeHandlesStyle
BoxPen ShapePen
BoxText ShapeText
CellCustomDraw CellCustomDraw
CellFrameStyle CellFrameStyle
ClearAll ClearAll
CreateImage CreateImage
CrossingRadius CrossingRadius
DefaultShape DefaultShape
Dirty Dirty
DisabledMnpColor DisabledHandlesColor
DocExtents Bounds
DrawStyledText DrawStyledText
DynamicArrows DynamicLinks
EffectsProvider EffectsProvider
EnableEmbossEffects EnableEmbossEffects
EnableLanes EnableLanes
EnableShadowEffects EnableShadowEffects
EnableStyledText EnableStyledText
ExpandButtonAction ExpandButtonAction
ExpandButtonPosition ExpandButtonPosition
ExpandOnIncoming ExpandOnIncoming
ExteriorBrush ExteriorBrush
FindArrow FindLink
FindBox FindNode
FindGroup FindGroup
FitDocToObjects ResizeToFitItems
Font Font
GetArrowAt GetLinkAt
GetBoxAt GetNodeAt
GetObjectAt GetItemAt
GridColor GridColor
GridOffsetX GridOffsetX
GridOffsetY GridOffsetY
GridSizeX GridSizeX
GridSizeY GridSizeY
GridStyle GridStyle
Groups Groups
HitTestPriority HitTestPriority
IntermArrowHead LinkIntermediateShape
IsTrialVersion IsTrialVersion
LaneGrid LaneGrid
LoadFromFile LoadFromFile
LoadFromStream LoadFromStream
LoadFromString LoadFromString
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3169
Joined: Oct 19th, 2005
FlowChart members moved to Diagram
Reply #13 - Jul 27th, 2007 at 5:24am
Print Post  
Old name New name
MeasureUnit MeasureUnit
MergeThreshold MergeThreshold
Objects Items
PolyTextLayout PolygonalTextLayout
RecursiveExpand RecursiveExpand
RestrObjsToDoc RestrictItemsToBounds
RoundedArrows RoundedLinks
RoundedArrowsRadius RoundedLinksRadius
RoundRectFactor RoundRectFactor
RouteAllArrows RouteAllLinks
RouteArrows RouteLinks
RoutingOptions RoutingOptions
SaveToFile SaveToFile
SaveToStream SaveToStream
SaveToString SaveToString
SelectAfterCreate SelectAfterCreate
Selection Selection
SelectionOnTop SelectionOnTop
SelHandleSize AdjustmentHandlesSize
SelMnpColor SelectedItemHandlesColor
SerializationOptions SerializationOptions
SetShadowOffset SetShadowOffset
ShadowColor ShadowColor
ShadowOffsetX ShadowOffsetX
ShadowOffsetY ShadowOffsetY
ShadowsStyle ShadowsStyle
ShapeOrientation ShapeOrientation
ShowAnchors ShowAnchors
ShowDisabledHandles ShowDisabledHandles
ShowGrid ShowGrid
SnapToAnchor SnapToAnchor
SortGroupsByZ SortGroupsByZ
TableBrush TableBrush
TableCaption TableCaption
TableCaptionHeight TableCaptionHeight
TableColumnCount TableColumnCount
TableColWidth TableColumnWidth
TableCustomDraw TableCustomDraw
TableHandlesStyle TableHandlesStyle
TableLinkStyle TableConnectionStyle
TablePen TablePen
TableRowCount TableRowCount
TableRowHeight TableRowHeight
TablesScrollable TablesScrollable
TableStyle TableStyle
Tag Tag
TextColor TextColor
TextFormat TextFormat
ToolTip ToolTip
UndoManager UndoManager
ValidityChecks ValidityChecks
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3169
Joined: Oct 19th, 2005
FlowChart members moved to DiagramView
Reply #14 - Jul 27th, 2007 at 5:30am
Print Post  
Old name New name
AllowInplaceEdit AllowInplaceEdit
CurArrowEnd AllowLinkCursor
AutoScroll AutoScroll
Behavior Behavior
BringIntoView BringIntoView
ClientToDoc ClientToDoc
ControlHostHandlesStyle ControlHandlesStyle
HostedCtrlMouseAction ControlMouseAction
CopyToClipboard CopyToClipboard
CurrentCursor CurrentCursor
CustomBehavior CustomBehavior
CurSecDgnlResize CounterDiagonalResizeCursor
CutToClipboard CutToClipboard
DefaultControlType DefaultControlType
CurMainDgnlResize DiagonalResizeCursor
CurCannotCreate DisallowCursor
CurArrowCannotCreate DisallowLinkCursor
CurArrowStart DrawLinkCursor
DocToClient DocToClient
CurHorzResize HorizontalResizeCursor
InplaceEditAcceptOnEnter InplaceEditAcceptOnEnter
InplaceEditCancelOnEsc InplaceEditCancelOnEsc
InplaceEditFont InplaceEditFont
CurLaneColumnResize LaneColumnResizeCursor
CurLaneRowResize LaneRowResizeCursor
MiddleButtonActions MiddleButtonActions
ModificationStart ModificationStart
ModifierKeyActions ModifierKeyActions
CurModify MoveCursor
PanCursor PanCursor
PasteFromClipboard PasteFromClipboard
CurPointer PointerCursor
PreviewOptions PreviewOptions
Print Print
PrintOptions PrintOptions
PrintPreview PrintPreview
PrintPreviewEx PrintPreviewEx
RecreateCacheImage RecreateCacheImage
RightButtonActions RightButtonActions
CurRotateShape RotateCursor
ScrollTo ScrollTo
ScrollX ScrollX
ScrollY ScrollY
ShowScrollbars ShowScrollbars
AntiAlias SmoothingMode
ShowToolTips ShowToolTips
TextRendering TextRenderingHint
ToolTipDelay ToolTipDelay
CurVertResize VerticalResizeCursor
ZoomFactor ZoomFactor
ZoomIn ZoomIn
ZoomOut ZoomOut
ZoomToFit ZoomToFit
ZoomToRect ZoomToRect
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint