private void CreateSampleData()
        {
            // create the sample nodes, defining a set of methods and events
            var collectionView = new ClassData("CollectionView",
                                               new List <string> {
                "GetEnumerator()"
            },
                                               new List <string> {
                "CollectionChanged"
            });
            var adjacentEdgesGraphSource = new ClassData("AdjacentEdgesGraphSource",
                                                         new List <string> {
                "GetBusinessObject()", "GetNode()", "GetGroup()", "GetNode()"
            },
                                                         new List <string>());
            var iGraph = new InterfaceData("IGraph",
                                           new List <string> {
                "Contains()", "Remove()", "CreateEdge()", "AddLabel()", "CreateNode()"
            },
                                           new List <string> {
                "NodeRemoved", "NodeCreated"
            });
            var iGroupedGraph = new ClassData("IGroupedGraph",
                                              new List <string> {
                "CreateNode()", "CreateGroupNode()"
            },
                                              new List <string>());
            var interactiveEdgesGraphSourceWindow = new ClassData("InteractiveEdgesGraphSourceWindow",
                                                                  new List <string>(),
                                                                  new List <string>());

            // add connections between the nodes
            adjacentEdgesGraphSource.EventRegistrations.Add(new EventRegistrationData(collectionView, "CollectionChanged"));
            adjacentEdgesGraphSource.MethodCalls.Add(new MethodCallData(collectionView, "GetEnumerator()"));
            adjacentEdgesGraphSource.MethodCalls.Add(new MethodCallData(iGraph, "Contains()"));
            adjacentEdgesGraphSource.MethodCalls.Add(new MethodCallData(iGraph, "Remove()"));
            adjacentEdgesGraphSource.MethodCalls.Add(new MethodCallData(iGraph, "CreateEdge()"));
            adjacentEdgesGraphSource.MethodCalls.Add(new MethodCallData(iGraph, "AddLabel()"));
            adjacentEdgesGraphSource.MethodCalls.Add(new MethodCallData(iGroupedGraph, "CreateNode()"));
            adjacentEdgesGraphSource.MethodCalls.Add(new MethodCallData(iGroupedGraph, "CreateGroupNode()"));
            iGroupedGraph.MethodCalls.Add(new MethodCallData(iGraph, "CreateNode()"));
            iGroupedGraph.EventRegistrations.Add(new EventRegistrationData(iGraph, "NodeRemoved"));
            iGroupedGraph.EventRegistrations.Add(new EventRegistrationData(iGraph, "NodeCreated"));
            interactiveEdgesGraphSourceWindow.MethodCalls.Add(new MethodCallData(adjacentEdgesGraphSource, "GetBusinessObject()"));

            graphSource.NodesSource = new ObservableCollection <EntityData>
            {
                collectionView, adjacentEdgesGraphSource, iGraph, iGroupedGraph, interactiveEdgesGraphSourceWindow
            };
        }
        public async void AddNodeExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            CreateNodeDialog createNodeDialog = new CreateNodeDialog();

            if (createNodeDialog.ShowDialog() == true)
            {
                EntityData data;
                switch (createNodeDialog.Type)
                {
                case CreateNodeDialog.ItemType.Class:
                    data = new ClassData(createNodeDialog.NodeName, createNodeDialog.MethodsList, createNodeDialog.EventsList);
                    break;

                case CreateNodeDialog.ItemType.Interface:
                    data = new InterfaceData(createNodeDialog.NodeName, createNodeDialog.MethodsList, createNodeDialog.EventsList);
                    break;

                default:
                    return;
                }
                ((ObservableCollection <EntityData>)graphSource.NodesSource).Add(data);
                await ApplyLayout(true, data);
            }
        }