diff --git a/SimpleStateMachineNodeEditor/CodeMap1.dgml b/SimpleStateMachineNodeEditor/CodeMap1.dgml new file mode 100644 index 0000000..799f261 --- /dev/null +++ b/SimpleStateMachineNodeEditor/CodeMap1.dgml @@ -0,0 +1,1779 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SimpleStateMachineNodeEditor/ViewModel/NodesCanvas/ViewModelNodesCanvasCommands.cs b/SimpleStateMachineNodeEditor/ViewModel/NodesCanvas/ViewModelNodesCanvasCommands.cs index 2f117bc..ab5018b 100644 --- a/SimpleStateMachineNodeEditor/ViewModel/NodesCanvas/ViewModelNodesCanvasCommands.cs +++ b/SimpleStateMachineNodeEditor/ViewModel/NodesCanvas/ViewModelNodesCanvasCommands.cs @@ -324,12 +324,35 @@ private void Open() #region setup start state - var startState = stateMachineXElement.Element("StartState")?.Attribute("Name")?.Value; - - if (string.IsNullOrEmpty(startState)) + var startStateElement = stateMachineXElement.Element("StartState"); + if (startStateElement == null) + { this.SetupStartState(); + } else - this.SetAsStart(this.Nodes.Items.Single(x => x.Name == startState)); + { + var startStateAttribute = startStateElement.Attribute("Name"); + if(startStateAttribute==null) + { + Error("Start state element don't has name attribute"); + return; + } + else + { + string startStateName = startStateAttribute.Value; + var startNode = this.Nodes.Items.SingleOrDefault(x => x.Name == startStateName); + if (startNode==null) + { + Error(string.Format("Unable to set start state. Node with name \"{0}\" don't exists", startStateName)); + return; + } + else + { + this.SetAsStart(startNode); + } + } + + } #endregion setup start state diff --git a/img/Custom window.jpg b/img/Custom window.jpg new file mode 100644 index 0000000..6053f7a Binary files /dev/null and b/img/Custom window.jpg differ diff --git a/img/Scaling.gif b/img/Scaling.gif new file mode 100644 index 0000000..558d638 Binary files /dev/null and b/img/Scaling.gif differ diff --git a/img/Themes.jpg b/img/Themes.jpg new file mode 100644 index 0000000..aa71e56 Binary files /dev/null and b/img/Themes.jpg differ diff --git a/img/adding.gif b/img/adding.gif new file mode 100644 index 0000000..7053e48 Binary files /dev/null and b/img/adding.gif differ diff --git a/img/collapsing and moving.gif b/img/collapsing and moving.gif new file mode 100644 index 0000000..59fdd6e Binary files /dev/null and b/img/collapsing and moving.gif differ diff --git a/img/deleting transitions.gif b/img/deleting transitions.gif new file mode 100644 index 0000000..d167e2c Binary files /dev/null and b/img/deleting transitions.gif differ diff --git a/img/jpg.jpg b/img/jpg.jpg new file mode 100644 index 0000000..f76ef68 Binary files /dev/null and b/img/jpg.jpg differ diff --git a/img/moving transitions.gif b/img/moving transitions.gif new file mode 100644 index 0000000..30abd31 Binary files /dev/null and b/img/moving transitions.gif differ diff --git a/img/naming for states and transitions.gif b/img/naming for states and transitions.gif new file mode 100644 index 0000000..4e70776 Binary files /dev/null and b/img/naming for states and transitions.gif differ diff --git a/img/selection.gif b/img/selection.gif new file mode 100644 index 0000000..b264b43 Binary files /dev/null and b/img/selection.gif differ diff --git a/img/undo and redo.gif b/img/undo and redo.gif new file mode 100644 index 0000000..d846c1e Binary files /dev/null and b/img/undo and redo.gif differ diff --git a/img/xml.jpg b/img/xml.jpg new file mode 100644 index 0000000..4c8b0b9 Binary files /dev/null and b/img/xml.jpg differ diff --git a/samples/sample.xml b/samples/sample.xml new file mode 100644 index 0000000..988341c --- /dev/null +++ b/samples/sample.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file