{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Embedded kernels \n", "\n", "This notebook and the C# project in this folder demonstrates how you can use .NET Interactive to embed a kernel within an app, connect to it from another kernel, and use the notebook to change the app's runtime state.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "## Connect to the WPF app\n", "\n", "First, let's start the WPF app and connect to it." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "dotnet_interactive": { "language": "pwsh" } }, "outputs": [], "source": [ "Start-Process -NoNewWindow dotnet run" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "polyglot_notebook": { "kernelName": "csharp" } }, "outputs": [], "source": [ "System.Diagnostics.Debugger.Launch();" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Once the cell above has finished running, you should see the WPF app window open. Next, we'll connect to it using a named pipe. The code that sets up the embedded kernel and the named pipe within the WPF app can be seen in [`App.xaml.cs`](https://github.com/dotnet/interactive/blob/main/samples/connect-wpf/App.xaml.cs).\n", "\n", "To connect using a named pipe, we'll need the following package:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "polyglot_notebook": { "kernelName": "csharp" } }, "outputs": [ { "data": { "text/html": [ "