fix cubetree init crash.

This commit is contained in:
iamboss 2026-02-17 15:42:50 +08:00
parent 68736b79fb
commit bb92237613
2 changed files with 20 additions and 2 deletions

View File

@ -14,7 +14,7 @@ namespace Hi.WpfPlus.Disp;
/// <remarks> /// <remarks>
/// <para> /// <para>
/// Usage pattern: call <see cref="DispFrameUtil.Call"/> to queue display content, /// Usage pattern: call <see cref="DispFrameUtil.Call"/> to queue display content,
/// then call <see cref="Run"/> to start the WPF application and show windows. /// then call <see cref="RunApplication()"/> to start the WPF application and show windows.
/// </para> /// </para>
/// <para> /// <para>
/// Each unique key creates a separate <see cref="RenderingWindow"/>. /// Each unique key creates a separate <see cref="RenderingWindow"/>.
@ -38,6 +38,9 @@ public static class WpfDispUtil
{ {
DispFrameUtil.UpdateByDispEngineConfigFunc = ApplyConfig; DispFrameUtil.UpdateByDispEngineConfigFunc = ApplyConfig;
} }
/// <summary>
/// Initializes the display engine.
/// </summary>
public static void Init() { public static void Init() {
DispEngine.Init(); DispEngine.Init();
} }
@ -60,14 +63,29 @@ public static class WpfDispUtil
if (config.SketchView != null) if (config.SketchView != null)
dispEngine.SketchView = config.SketchView; dispEngine.SketchView = config.SketchView;
} }
/// <summary>
/// Configures the display engine with the specified displayees for the given title.
/// </summary>
/// <param name="title">The title/key to identify the display window.</param>
/// <param name="displayees">The displayees to be configured.</param>
/// <returns>The display engine configuration.</returns>
public static DispEngineConfig Call( public static DispEngineConfig Call(
string title, params IDisplayee[] displayees)=> string title, params IDisplayee[] displayees)=>
DispFrameUtil.Call(title, displayees); DispFrameUtil.Call(title, displayees);
/// <summary>
/// Configures the display engine with the specified displayees and starts the WPF application.
/// </summary>
/// <param name="title">The title/key to identify the display window.</param>
/// <param name="displayees">The displayees to be configured.</param>
public static void RunApplication(string title, params IDisplayee[] displayees) public static void RunApplication(string title, params IDisplayee[] displayees)
{ {
DispFrameUtil.Call(title, displayees); DispFrameUtil.Call(title, displayees);
RunApplication(); RunApplication();
} }
/// <summary>
/// Starts the WPF application and shows all configured windows.
/// Blocks until all windows are closed.
/// </summary>
public static void RunApplication() public static void RunApplication()
{ {
Application app = new Application() Application app = new Application()

View File

@ -12,7 +12,7 @@
HiAPI wpf canvas. HiAPI wpf canvas.
</Description> </Description>
<Configurations>Debug;Release</Configurations> <Configurations>Debug;Release</Configurations>
<VersionBuild>115</VersionBuild> <VersionBuild>118</VersionBuild>
<VersionPrefix>3.1.$(VersionBuild)</VersionPrefix> <VersionPrefix>3.1.$(VersionBuild)</VersionPrefix>
<PackageId>Hi.WpfPlus</PackageId> <PackageId>Hi.WpfPlus</PackageId>
<PackageTags>HiAPI</PackageTags> <PackageTags>HiAPI</PackageTags>