private void MenuItem_New_Click(object sender, RoutedEventArgs e) { SetupGraph(); DialogPage page = new DialogPage(this); mRootNode = createNewVertex(page); mRootNode.Page.Label = "Starting Point"; AddNode(mRootNode); Area.GenerateGraph(true, true); zoomctrl.ZoomToFill(); Area.RelayoutGraph(); }
private void onNodeClick(object node) { DataVertex dv = node as DataVertex; var page = dv.Page; PageEditor pe = new PageEditor(); pe.Owner = this; if (page is DialogPage) { DialogPage dp = page as DialogPage; if (dp.isSubTreeCommand) { var jsonFile = dp.OptionOwner.Command; string codeBase = Assembly.GetExecutingAssembly().CodeBase; string path = Uri.UnescapeDataString(new UriBuilder(codeBase).Path); var file = System.IO.Path.Combine(Directory.GetCurrentDirectory(), jsonFile); Process.Start(new ProcessStartInfo(path, "\"" + file + "\"")); return; } pe.DataContext = page; } else { var option = dv.Page as DialogOption; if (option.Target == null) { option.Target = new DialogPage(this); option.Target.Vertex = option.Vertex; } pe.DataContext = option.Target; } pe.ShowDialog(); Area.RelayoutGraph(); Area.GenerateGraph(true, true); }
void DialogWindow_Loaded(object sender, RoutedEventArgs e) { var args = Environment.GetCommandLineArgs(); if (args.Length > 1) { var json = args[1]; Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(json)); this.Title += " " + System.IO.Path.GetFileName(json); if (File.Exists(json)) { Area.ClearLayout(); mGraph.Clear(); var page = DialogLoader.Load(json); BuildGraph(page, null); mRootNode = page.Vertex; Area.GenerateGraph(true, true); zoomctrl.ZoomToFill(); Area.RelayoutGraph(); } else { SetupGraph(); DialogPage page = new DialogPage(this); mRootNode = createNewVertex(page); mRootNode.Page.Label = "Starting Point"; AddNode(mRootNode); Area.GenerateGraph(true, true); zoomctrl.ZoomToFill(); Area.RelayoutGraph(); } mOpenFile = json; } }
public void AddNode(DataVertex dv) { mGraph.AddVertex(dv); }