Update sample Iris app and debug client

This commit is contained in:
Yoshi Askharoun
2023-05-23 20:12:35 -05:00
parent c938b1789a
commit a7fea61af6
4 changed files with 63 additions and 27 deletions
+24 -8
View File
@@ -1,25 +1,41 @@
using Microsoft.Iris.Debug; using Microsoft.Iris.Debug;
using Microsoft.Iris.Debug.Data;
using System;
namespace SimpleDebugClient namespace SimpleDebugClient;
internal class Program
{ {
internal class Program static IDebuggerClient? Debugger { get; set; }
{
static void Main(string[] args) static void Main(string[] args)
{ {
Bridge bridge = new(OwlCore.Remoting.RemotingMode.Client); string connectionString = args.Length >= 2
? args[1] : "tcp://127.0.0.1:5556";
Console.WriteLine("Listening for debug messages. Press ENTER to exit."); Console.CancelKeyPress += Console_CancelKeyPress;
Debugger = new ZmqDebuggerClient(connectionString);
Debugger.DispatcherStep += Debugger_DispatcherStep;
Debugger.InterpreterStep += Debugger_InterpreterStep;
Console.WriteLine("Listening for debug messages. Press Ctrl-C to exit.");
Console.ReadLine(); Console.ReadLine();
} }
private static void Bridge_DispatcherStep(string obj) private static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
{
if (Debugger is IDisposable debugger)
debugger.Dispose();
}
private static void Debugger_DispatcherStep(string obj)
{ {
Console.WriteLine(obj); Console.WriteLine(obj);
} }
private static void Bridge_InterpreterStep(object? sender, Microsoft.Iris.Debug.Data.InterpreterEntry e) private static void Debugger_InterpreterStep(object? sender, InterpreterEntry e)
{ {
Console.WriteLine(e); Console.WriteLine(e);
} }
}
} }
@@ -2,10 +2,11 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>x86;x64</Platforms>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\UIX\UIX.csproj" />
</ItemGroup>
</Project> </Project>
+24 -1
View File
@@ -1,6 +1,5 @@
using Microsoft.Iris; using Microsoft.Iris;
using System; using System;
using System.IO;
namespace SimpleIrisApp; namespace SimpleIrisApp;
@@ -8,6 +7,21 @@ internal class Program
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
#if DEBUG
Console.WriteLine("Starting debugger server...");
Application.DebuggerServerReady += (_, __) =>
{
var textColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine($"Debugger server ready at {Application.DebugSettings.DebugConnectionUri}");
Console.ForegroundColor = textColor;
};
Application.DebugSettings.DebugConnectionUri = args.Length >= 2
? args[1] : "tcp://127.0.0.1:5556";
#endif
Console.WriteLine("Initializing Iris..."); Console.WriteLine("Initializing Iris...");
Application.Initialize(); Application.Initialize();
@@ -24,5 +38,14 @@ internal class Program
var rootUi = Application.Window.Form.Zone.RootUI; var rootUi = Application.Window.Form.Zone.RootUI;
var rootView = Application.Window.Form.Zone.RootViewItem; var rootView = Application.Window.Form.Zone.RootViewItem;
rootView.DeepLayoutChange += RootView_DeepParentChange;
Console.WriteLine("Visual tree ready");
}
private static void RootView_DeepParentChange(object? sender, EventArgs e)
{
} }
} }
+2 -6
View File
@@ -2,20 +2,16 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>x86;x64</Platforms>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\UIX\UIX.csproj" />
<EmbeddedResource Include="Assets\*.*" /> <EmbeddedResource Include="Assets\*.*" />
<EmbeddedResource Include="Pages\*.*" /> <EmbeddedResource Include="Pages\*.*" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\UIX\UIX.csproj" />
</ItemGroup>
<Target Name="CopyCustomContent" AfterTargets="AfterBuild"> <Target Name="CopyCustomContent" AfterTargets="AfterBuild">
<Copy SourceFiles="..\..\UIXrender.dll" DestinationFolder="$(OutDir)" /> <Copy SourceFiles="..\..\UIXrender.dll" DestinationFolder="$(OutDir)" />
</Target> </Target>