コード例 #1
0
        public SimpleController()
        {
            if (Environment.GetCommandLineArgs().Length <= 1)
            {
                throw new ArgumentException("No filename argument given!");
            }
            var filename   = Environment.GetCommandLineArgs()[1];
            var dotContent = File.ReadAllText(filename);

            try {
                GraphParser.CheckSyntax(dotContent);
            } catch (Exception e) {
                throw new ArgumentException("Invalid graph syntax:" + Environment.NewLine + e.Message);
            }
            var graph       = GraphParser.GetGraph(dotContent);
            var layoutGraph = GraphParser.GetGraphLayout(graph.ToDot());

            Graph = new WpfGraph(layoutGraph);
        }
コード例 #2
0
 private void UpdateOriginalGraphFromDotContent()
 {
     try {
         var graph = GraphParser.GetGraph(OriginalDotContent);
         GraphParser.CheckSyntax(OriginalDotContent);
         OriginalGraph       = graph;
         ParseFailureMessage = "";
     } catch (Exception e) {
         ParseFailureMessage = e.Message;
     }
     if (OriginalGraph == null)
     {
         OriginalGraph = Graph.CreateGraph();
     }
     if (string.IsNullOrEmpty(ParseFailureMessage))
     {
         RestrictSelection();
         RaiseContentChanged();
     }
 }