diff --git a/Disp/RenderingCanvas.cs b/Disp/RenderingCanvas.cs
index 6045689..5ae8f8e 100644
--- a/Disp/RenderingCanvas.cs
+++ b/Disp/RenderingCanvas.cs
@@ -13,6 +13,15 @@ using Hi.Geom;
namespace Hi.Wpf.Disp
{
#region WPF Rendering Canvas
+ ///
+ /// Provides a WPF rendering canvas for 3D visualization of HiAPI components.
+ /// Handles user interactions, rendering, and integration with the DispEngine system.
+ ///
+ ///
+ /// This canvas provides the core rendering capabilities for WPF applications using HiAPI.
+ /// It manages mouse, keyboard, and touch events, and transforms them into appropriate
+ /// actions in the 3D environment.
+ ///
public class RenderingCanvas : UserControl, IDisposable
{
#region Core_Properties
diff --git a/Disp/RenderingWindow.cs b/Disp/RenderingWindow.cs
index 2af8d94..35dbd09 100644
--- a/Disp/RenderingWindow.cs
+++ b/Disp/RenderingWindow.cs
@@ -11,6 +11,9 @@ namespace Hi.Wpf.Disp
///
public class RenderingWindow : Window, IGetDispEngine
{
+ ///
+ /// Gets the rendering canvas control used for displaying 3D content.
+ ///
public RenderingCanvas RenderingCanvas => Content as RenderingCanvas;
///
@@ -35,29 +38,19 @@ namespace Hi.Wpf.Disp
///
public DispEngine GetDispEngine() => RenderingCanvas.DispEngine;
///
- /// Run a simple application with given .
+ /// Gets or sets the current displayable 3D object.
+ /// When setting a new displayee, the view will be reset to home position if no previous displayee was set.
///
- /// Title
- /// displayees
- /// return value of .
- public static int RunApplication(string title, params IDisplayee[] displayees)
+ public IDisplayee Displayee
{
- License.LogInAll();
- DispEngine.Init();
-
- Application app = new Application
+ get => GetDispEngine().Displayee;
+ set
{
- ShutdownMode = ShutdownMode.OnMainWindowClose
- };
- app.Exit += (o, e) =>
- {
- DispEngine.FinishDisp();
- License.LogOutAll();
- };
- RenderingWindow window = new RenderingWindow() { Title = title };
- window.RenderingCanvas.DispEngine.Displayee = new DispList(displayees);
- window.RenderingCanvas.DispEngine.SetViewToHomeView();
- return app.Run(window);
+ var preDisplayee = GetDispEngine().Displayee;
+ GetDispEngine().Displayee = value;
+ if (preDisplayee == null)
+ RenderingCanvas.DispEngine.SetViewToHomeView();
+ }
}
}
}
diff --git a/Hi.Wpf.csproj b/Hi.Wpf.csproj
index 531b216..3f19106 100644
--- a/Hi.Wpf.csproj
+++ b/Hi.Wpf.csproj
@@ -12,16 +12,18 @@
HiAPI samples for windows platform.
Debug;Release
- 3
+ 15
1.4.$(VersionBuild)
+ HiAPI
+ win-x64
$(AssemblyName)
techcoordinate.ico
- Copyright 2022 Tech Coordinate Co., Ltd.
+ Copyright 2025 Tech Coordinate Co., Ltd.
Tech Coordinate Co., Ltd.
Tech Coordinate Co., Ltd.
- bin\$(Platform).$(Configuration)\
Hi.Wpf.Program
+
@@ -37,4 +39,5 @@
DEBUG;TRACE
+
\ No newline at end of file
diff --git a/Program.cs b/Program.cs
index 1c7b276..0f079b7 100644
--- a/Program.cs
+++ b/Program.cs
@@ -1,19 +1,36 @@
using Hi.Disp;
using Hi.Disp.Flag;
using Hi.Geom;
+using Hi.Licenses;
using Hi.Wpf.Disp;
using System;
+using System.Windows;
namespace Hi.Wpf
{
static class Program
{
[STAThread]
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
+ License.LogInAll();
DispEngine.Init();
- RenderingWindow.RunApplication("test",
+
+ Application app = new Application
+ {
+ ShutdownMode = ShutdownMode.OnMainWindowClose
+ };
+ app.Exit += (o, e) =>
+ {
+ DispEngine.FinishDisp();
+ License.LogOutAll();
+ Console.WriteLine($"App exit.");
+ };
+ RenderingWindow window = new RenderingWindow() { Title = "Demo WPF RenderingCanvas" };
+ window.RenderingCanvas.DispEngine.Displayee = new DispList(
new CoordinateDrawing(), new Stl(Box3d.CenterUnitBox).ToFaceDrawing());
+ window.RenderingCanvas.DispEngine.SetViewToHomeView();
+ return app.Run(window);
}
}
}