public MainWindowViewModel() { //load dot file var parser = Dot.AntlrParser.AntlrParserAdapter<string>.GetParser(); var dotFileReader = new StreamReader(@"D:\Github\LiveActive\SmartAnalyzer\Projects\callgraph.dot"); var result = parser.Parse(dotFileReader); // if (result != null) // this.Graph = result; var graph = new Graph<Person>(); var a = new Person(graph) { Name = "Jonh", Avatar = "./Avatars/avatar1.jpg" }; var b = new Person(graph) { Name = "Michael", Avatar = "./Avatars/avatar2.gif" }; var c = new Person(graph) { Name = "Kenny" }; var d = new Person(graph) { Name = "Lisa" }; var e = new Person(graph) { Name = "Lucy", Avatar = "./Avatars/avatar3.jpg" }; var f = new Person(graph) { Name = "Ted Mosby" }; var g = new Person(graph) { Name = "Glen" }; var h = new Person(graph) { Name = "Alice", Avatar = "./Avatars/avatar1.jpg" }; graph.AddVertex(a); graph.AddVertex(b); graph.AddVertex(c); graph.AddVertex(d); graph.AddVertex(e); graph.AddVertex(f); var subGraph = new SubGraph<Person> { Label = "Work" }; graph.AddSubGraph(subGraph); subGraph.AddVertex(g); subGraph.AddVertex(h); graph.AddEdge(new Edge<Person>(g, h)); graph.AddEdge(new Edge<Person>(a, g)); var subGraph2 = new SubGraph<Person> {Label = "School"}; graph.AddSubGraph(subGraph2); var loner = new Person(graph) { Name = "Loner", Avatar = "./Avatars/avatar1.jpg" }; subGraph2.AddVertex(loner); graph.AddEdge(new Edge<SubGraph<Person>>(subGraph, subGraph2) { Label = "Link between groups" } ); graph.AddEdge(new Edge<Person>(c, d) { Label = "In love", DestinationArrowLabel = "boyfriend", SourceArrowLabel = "girlfriend" }); graph.AddEdge(new Edge<Person>(c, g, new Arrow(), new Arrow())); graph.AddEdge(new Edge<Person>(c, a, new Arrow()) { Label = "Boss" }); graph.AddEdge(new Edge<Person>(d, h, new DiamondArrow(), new DiamondArrow())); graph.AddEdge(new Edge<Person>(f, h, new DiamondArrow(), new DiamondArrow())); graph.AddEdge(new Edge<Person>(f, loner, new DiamondArrow(), new DiamondArrow())); graph.AddEdge(new Edge<Person>(f, b, new DiamondArrow(), new DiamondArrow())); graph.AddEdge(new Edge<Person>(e, g, new Arrow(), new Arrow()) { Label = "Siblings" }); this.Graph = graph; this.Graph.Changed += GraphChanged; this.NewPersonName = "Enter new name"; this.UpdatePersonNewName = "Enter new name"; }
public MainWindowViewModel() { var graph = new Graph<Person>(); var a = new Person(graph) { Name = "Jonh", Avatar = "./Avatars/avatar1.jpg" }; var b = new Person(graph) { Name = "Michael", Avatar = "./Avatars/avatar2.gif" }; var c = new Person(graph) { Name = "Kenny" }; var d = new Person(graph) { Name = "Lisa" }; var e = new Person(graph) { Name = "Lucy", Avatar = "./Avatars/avatar3.jpg" }; var f = new Person(graph) { Name = "Ted Mosby" }; var g = new Person(graph) { Name = "Glen" }; var h = new Person(graph) { Name = "Alice", Avatar = "./Avatars/avatar1.jpg" }; graph.AddVertex(a); graph.AddVertex(b); graph.AddVertex(c); graph.AddVertex(d); graph.AddVertex(e); graph.AddVertex(f); var subGraph = new SubGraph<Person> { Label = "Work" }; graph.AddSubGraph(subGraph); subGraph.AddVertex(g); subGraph.AddVertex(h); graph.AddEdge(new Edge<Person>(g, h)); graph.AddEdge(new Edge<Person>(a, g)); var subGraph2 = new SubGraph<Person> {Label = "School"}; graph.AddSubGraph(subGraph2); var loner = new Person(graph) { Name = "Loner", Avatar = "./Avatars/avatar1.jpg" }; subGraph2.AddVertex(loner); graph.AddEdge(new Edge<SubGraph<Person>>(subGraph, subGraph2) { Label = "Link between groups" } ); graph.AddEdge(new Edge<Person>(c, d) { Label = "In love", DestinationArrowLabel = "boyfriend", SourceArrowLabel = "girlfriend" }); graph.AddEdge(new Edge<Person>(c, g, new Arrow(), new Arrow())); graph.AddEdge(new Edge<Person>(c, a, new Arrow()) { Label = "Boss" }); graph.AddEdge(new Edge<Person>(d, h, new DiamondArrow(), new DiamondArrow())); graph.AddEdge(new Edge<Person>(f, h, new DiamondArrow(), new DiamondArrow())); graph.AddEdge(new Edge<Person>(f, loner, new DiamondArrow(), new DiamondArrow())); graph.AddEdge(new Edge<Person>(f, b, new DiamondArrow(), new DiamondArrow())); graph.AddEdge(new Edge<Person>(e, g, new Arrow(), new Arrow()) { Label = "Siblings" }); this.Graph = graph; this.Graph.Changed += GraphChanged; this.NewPersonName = "Enter new name"; this.UpdatePersonNewName = "Enter new name"; }