migrate
This commit is contained in:
parent
1065c86824
commit
b68c5618ae
@ -13,6 +13,15 @@ using Hi.Geom;
|
||||
namespace Hi.Wpf.Disp
|
||||
{
|
||||
#region WPF Rendering Canvas
|
||||
/// <summary>
|
||||
/// Provides a WPF rendering canvas for 3D visualization of HiAPI components.
|
||||
/// Handles user interactions, rendering, and integration with the DispEngine system.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 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.
|
||||
/// </remarks>
|
||||
public class RenderingCanvas : UserControl, IDisposable
|
||||
{
|
||||
#region Core_Properties
|
||||
|
@ -11,6 +11,9 @@ namespace Hi.Wpf.Disp
|
||||
/// </summary>
|
||||
public class RenderingWindow : Window, IGetDispEngine
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the rendering canvas control used for displaying 3D content.
|
||||
/// </summary>
|
||||
public RenderingCanvas RenderingCanvas => Content as RenderingCanvas;
|
||||
|
||||
/// <summary>
|
||||
@ -35,29 +38,19 @@ namespace Hi.Wpf.Disp
|
||||
/// <inheritdoc/>
|
||||
public DispEngine GetDispEngine() => RenderingCanvas.DispEngine;
|
||||
/// <summary>
|
||||
/// Run a simple <see cref="RenderingWindow"/> application with given <paramref name="displayees"/>.
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="title">Title</param>
|
||||
/// <param name="displayees">displayees</param>
|
||||
/// <returns>return value of <see cref="Application"/>.<see cref="Application.Run(Window)"/></returns>
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,16 +12,18 @@
|
||||
HiAPI samples for windows platform.
|
||||
</Description>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<VersionBuild>3</VersionBuild>
|
||||
<VersionBuild>15</VersionBuild>
|
||||
<VersionPrefix>1.4.$(VersionBuild)</VersionPrefix>
|
||||
<PackageTags>HiAPI</PackageTags>
|
||||
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
|
||||
<Product>$(AssemblyName)</Product>
|
||||
<ApplicationIcon>techcoordinate.ico</ApplicationIcon>
|
||||
<Copyright>Copyright 2022 Tech Coordinate Co., Ltd.</Copyright>
|
||||
<Copyright>Copyright 2025 Tech Coordinate Co., Ltd.</Copyright>
|
||||
<Company>Tech Coordinate Co., Ltd.</Company>
|
||||
<Authors>Tech Coordinate Co., Ltd.</Authors>
|
||||
<OutputPath>bin\$(Platform).$(Configuration)\</OutputPath>
|
||||
<StartupObject>Hi.Wpf.Program</StartupObject>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\acc\common_info.props" />
|
||||
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<ProjectReference Include="..\HiDisp\HiDisp.csproj" />
|
||||
</ItemGroup>
|
||||
@ -37,4 +39,5 @@
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\acc\deploy_local_nupkg.targets" Condition="'$(Configuration)'=='Release'" />
|
||||
</Project>
|
21
Program.cs
21
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user