private void RenderDrawing(string warning) { if (expr == null) { return; } using (DrawingContext ctx = group.Open()) { if (warning != null) { Typeface type = new Typeface("맑은 고딕"); FormattedText warningText = new FormattedText(warning, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, type, 12, Brushes.Red, 1); ctx.DrawText(warningText, new Point(5, 0)); ctx.PushTransform(new TranslateTransform(0, 20)); } TreeRenderer.RenderTree(new WpfTreeRenderContext(ctx), expr); if (warning != null) { ctx.Pop(); } } }
/// <summary> /// Make a default TreeListView /// </summary> public TreeListView() { TreeModel = new Tree(this); OwnerDraw = true; View = View.Details; DataSource = TreeModel; TreeColumnRenderer = new TreeRenderer(); }
public override string ToString() { var tree = new TreeRenderer(); tree.PrintLine("─" + DescriptorName); PrintPackages(tree); return tree.Content; }
private void GameTreeBox_Paint(object sender, PaintEventArgs e) { TreeRenderer treeRenderer = new TreeRenderer(new GoClient.Drawing.GraphicsSystem()); treeRenderer.Scroll = GameTreePaintBox.AutoScrollPosition.Convert(); treeRenderer.Graphics = new GoClient.Drawing.Graphics(e.Graphics); treeRenderer.ClipRect = e.ClipRectangle.Convert(); treeRenderer.Game = Game; treeRenderer.BlockSize = TreeBlockSize; treeRenderer.Render(); }
public override Task Execute() { Workspace.Instance.CreateEphemeral(ServiceMap); var treeRenderer = new TreeRenderer(); Console.WriteLine(Output.Reversed().White().Text(Path.GetFileName(ServiceMap))); foreach (var feature in Workspace.Instance.Features) { treeRenderer.PrintNode(feature, "", Workspace.Instance.Features.Last() == feature); } return(Task.FromResult(0)); }
private void InitControls() { if (!this.useSourceConnector) { int increaseHeight = this.sourceDbProfile.Height; this.sourceDbProfile.Visible = false; this.btnCompare.Height = this.targetDbProfile.ClientHeight; this.targetDbProfile.Top -= increaseHeight; this.splitContainer1.Top -= increaseHeight; this.splitContainer1.Height += increaseHeight; } this.colType.ImageGetter = delegate(object x) { DbDifference difference = x as DbDifference; if (difference.DatabaseObjectType == DatabaseObjectType.None) { return("tree_Folder.png"); } else { return($"tree_{difference.DatabaseObjectType}.png"); } }; TreeRenderer treeColumnRenderer = this.tlvDifferences.TreeColumnRenderer; treeColumnRenderer.IsShowGlyphs = true; treeColumnRenderer.UseTriangles = true; TreeRenderer renderer = this.tlvDifferences.TreeColumnRenderer; renderer.LinePen = new Pen(Color.LightGray, 0.5f); renderer.LinePen.DashStyle = DashStyle.Dot; FlagRenderer differenceTypeRenderer = new FlagRenderer(); differenceTypeRenderer.ImageList = this.imageList2; differenceTypeRenderer.Add(DbDifferenceType.Added, "Add.png"); differenceTypeRenderer.Add(DbDifferenceType.Modified, "Edit.png"); differenceTypeRenderer.Add(DbDifferenceType.Deleted, "Remove.png"); this.colChangeType.Renderer = differenceTypeRenderer; this.colChangeType.ClusteringStrategy = new FlagClusteringStrategy(typeof(DbDifferenceType)); this.tlvDifferences.Refresh(); }
private static void ParserDemo() { Console.WriteLine("Hello World!"); var text = @"x = 'abc"; var window = new TextWindowWithNull(text, "noname"); var parser = CreateParser(window); var tree = parser.Parse(); TreeRenderer.RenderTree(tree); if (tree.Diagnostics.Any()) { foreach (var diagnostic in tree.Diagnostics) { Console.WriteLine($"ERROR: {diagnostic.Message} at position {diagnostic.Span.Start}"); } } Console.ReadKey(); }
public override Task Execute() { Workspace.Instance.CreateEphemeral(ServiceMap); var treeRenderer = new TreeRenderer(); treeRenderer.AfterPluginPointerDrawn += (indent, isLast, pluginPointer) => { _tasksGenerated++; var plugin = _loadedExtensions.FirstOrDefault(e => e.Item1.Equals(pluginPointer.Plugin)); var newIndent = treeRenderer.WriteExecutedTest("Supports Plugin type?", () => plugin != null, indent, isLast); if (plugin != null) { var tests = new Tuple <string, Func <bool?> >[] { Tuple.Create("Plugin pointer has valid options?", new Func <bool?>(() => Workspace.Instance.Validate(pluginPointer))), Tuple.Create("Resource Map contains Resource?", new Func <bool?>(() => { if (pluginPointer.Resource == null) { return(null); } return(ResourceManager.Instance.ContainsPointer(pluginPointer.Resource)); })) }; foreach (var test in tests) { treeRenderer.WriteExecutedTest(test.Item1, test.Item2, newIndent, tests.Last().Equals(test)); } } }; Console.WriteLine(Output.Reversed().White().Text(Path.GetFileName(ServiceMap))); foreach (var feature in Workspace.Instance.Features) { treeRenderer.PrintNode(feature, "", Workspace.Instance.Features.Last() == feature); } Logger.LogInformation( "Validation of {0} complete! Tests: {1} passed, {2} failed. Service Map scan will generate {3} tasks.", ServiceMap, treeRenderer.TestsPassed, treeRenderer.TestsFailed, _tasksGenerated); return(Task.FromResult(0)); }
public override void OnInspectorGUI() { TreeRenderer constructor = (TreeRenderer)target; DrawDefaultInspector(); if (GUILayout.Button("Create Tree Pool")) { constructor.CreateTreePool(); EditorUtility.SetDirty(constructor); } if (GUILayout.Button("Clear Tree Pool")) { constructor.ClearTreePool(); EditorUtility.SetDirty(constructor); } if (GUILayout.Button("Update Trees")) { constructor.UpdateTreesAroundEditorCamera(); } }
void OnGUI() { if (GUILayout.Button("New Tree")) { if (drawTree != null) { drawTree.ClearTree(); } drawTree = new TreeRenderer(); drawTree.NewTree(); } if (GUILayout.Button("Destroy Tree")) { drawTree.DestroyTree(); } GUILayout.Space(10f); if (GUILayout.Button("Add Selector")) { drawTree.AddSelector(); } if (GUILayout.Button("Add Sequence")) { drawTree.AddSequence(); } if (GUILayout.Button("Add Action")) { drawTree.AddAction(); } if (GUILayout.Button("Add Node")) { drawTree.AddNode(Enums.types.selector, "New node"); } }
void PrintPackages(TreeRenderer tree) { Packages.Select(_ => new Node<Package>(_, PrintPackage)) .Cast<Node>() .Render(tree); }
void PrintPackage(TreeRenderer tree, Package package) { var packageName = package.PackageInfo.Name + " " + package.PackageInfo.SemanticVersion; if (package.PackageInfo.Title != null) packageName += " (" + package.PackageInfo.Title + ")"; if (package.Locked) packageName += " [locked]"; var dependsLine = "depends: " + package.Spec; tree.PrintLine(IncludeDependencies ? dependsLine : packageName); var childNodes = package.Children == Truncated ? new[] { new Node<string>("...", (t, val) => t.PrintLine(val)) } : package.Children.Select(_ => new Node<Package>(_, PrintPackage)).Cast<Node>(); if (!IncludeDependencies) childNodes.Render(tree); else { new[]{new Node<string>(packageName, (t, val) => { t.PrintLine(val); childNodes.Render(t); })}.Render(tree); } }
public static void Render(this IEnumerable<Node> nodes, TreeRenderer renderer) { renderer.PrintChildren(nodes, node => node.Render(renderer)); }
public abstract void Render(TreeRenderer tree);
public abstract void Render(TreeRenderer tree);