Ejemplo n.º 1
0
        internal static void RenderExecutionPath(this ExecutionPathTracer.ExecutionPathTracer tracer,
                                                 IChannel channel,
                                                 string executionPathDivId,
                                                 int renderDepth,
                                                 TraceVisualizationStyle style)
        {
            // Retrieve the `ExecutionPath` traced out by the `ExecutionPathTracer`
            var executionPath = tracer.GetExecutionPath();

            // Convert executionPath to JToken for serialization
            var executionPathJToken = JToken.FromObject(executionPath,
                                                        new JsonSerializer()
            {
                NullValueHandling = NullValueHandling.Ignore
            });

            // Send execution path to JavaScript via iopub for rendering
            channel.SendIoPubMessage(
                new Message
            {
                Header = new MessageHeader
                {
                    MessageType = "render_execution_path"
                },
                Content = new ExecutionPathVisualizerContent
                          (
                    executionPathJToken,
                    executionPathDivId,
                    renderDepth,
                    style
                          )
            }
                );
        }
Ejemplo n.º 2
0
 /// <summary>
 ///     Initializes <see cref="ExecutionPathVisualizerContent"/> with the
 ///     given <see cref="ExecutionPath"/>.
 /// </summary>
 /// <param name="executionPath">
 ///     <see cref="ExecutionPath"/> (as a <see cref="JToken"/>) to be visualized.
 /// </param>
 /// <param name="id">
 ///     HTML div ID to inject visualization into.
 /// </param>
 /// <param name="renderDepth">
 ///     The initial renderDepth at which to visualize the execution path.
 /// </param>
 /// <param name="style">
 ///     The  <see cref="TraceVisualizationStyle"/> for visualizing the execution path.
 /// </param>
 public ExecutionPathVisualizerContent(JToken executionPath, string id, int renderDepth, TraceVisualizationStyle style)
 {
     this.ExecutionPath = executionPath;
     this.Id            = id;
     this.Style         = style.ToString();
     this.RenderDepth   = renderDepth;
 }