migrate
This commit is contained in:
parent
90fe4a916a
commit
3346f74edc
@ -1,14 +1,14 @@
|
||||
using Hi.Disp;
|
||||
using Hi.Disp.Flag;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Hi.WinForm.Disp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="Form"/> contains <see cref="RenderingCanvas"/>.
|
||||
/// A <see cref="Form"/> contains <see cref="Disp.RenderingCanvas"/>.
|
||||
/// This class is usually used for debug due to its simplicity.
|
||||
/// </summary>
|
||||
public partial class RenderingForm : Form, IGetDispEngine
|
||||
@ -27,14 +27,26 @@ namespace Hi.WinForm.Disp
|
||||
internal RenderingForm(params IDisplayee[] displayees)
|
||||
{
|
||||
InitializeComponent();
|
||||
Displayer = new RenderingCanvas(displayees);
|
||||
this.Controls.Add(Displayer);
|
||||
RenderingCanvas = new RenderingCanvas(displayees);
|
||||
this.Controls.Add(RenderingCanvas);
|
||||
//Displayer.DispEngine.Start();
|
||||
}
|
||||
/// <summary>
|
||||
/// The contained <see cref="RenderingCanvas"/>.
|
||||
/// The contained <see cref="Disp.RenderingCanvas"/>.
|
||||
/// </summary>
|
||||
public RenderingCanvas Displayer { get; }
|
||||
public RenderingCanvas RenderingCanvas { get; }
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public IDisplayee Displayee
|
||||
{
|
||||
get => GetDispEngine().Displayee;
|
||||
set
|
||||
{
|
||||
var preDisplayee = GetDispEngine().Displayee;
|
||||
GetDispEngine().Displayee = value;
|
||||
if (preDisplayee == null)
|
||||
RenderingCanvas.DispEngine.SetViewToHomeView();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Create and obtain a <see cref="RenderingForm"/> if the key has not existed; Otherwise, the old one is obtained.
|
||||
/// <paramref name="displayees"/> are set to the obtained <see cref="RenderingForm"/>.
|
||||
@ -47,7 +59,7 @@ namespace Hi.WinForm.Disp
|
||||
{
|
||||
if (displayerMap.TryGetValue(key, out RenderingForm f))
|
||||
{
|
||||
f.Displayer.DispEngine.Displayee = new DispList(displayees);
|
||||
f.RenderingCanvas.DispEngine.Displayee = new DispList(displayees);
|
||||
return f;
|
||||
}
|
||||
else
|
||||
@ -77,7 +89,7 @@ namespace Hi.WinForm.Disp
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
Displayer.Dispose();
|
||||
RenderingCanvas.Dispose();
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
@ -85,7 +97,7 @@ namespace Hi.WinForm.Disp
|
||||
/// <inheritdoc/>
|
||||
public DispEngine GetDispEngine()
|
||||
{
|
||||
return Displayer.DispEngine;
|
||||
return RenderingCanvas.DispEngine;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<RootNamespace>$(AssemblyName)</RootNamespace>
|
||||
<Platforms>x64</Platforms>
|
||||
<Description>WinForm Display module of HiAPI</Description>
|
||||
<VersionBuild>4</VersionBuild>
|
||||
<VersionBuild>13</VersionBuild>
|
||||
<VersionPrefix>1.2.$(VersionBuild)</VersionPrefix>
|
||||
<PackageTags>HiAPI</PackageTags>
|
||||
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
|
||||
|
||||
15
Program.cs
15
Program.cs
@ -1,6 +1,7 @@
|
||||
using Hi.Disp;
|
||||
using Hi.Disp.Flag;
|
||||
using Hi.Geom;
|
||||
using Hi.Licenses;
|
||||
using Hi.WinForm.Disp;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
@ -15,18 +16,20 @@ namespace Hi.WinForm
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
License.LogInAll();
|
||||
DispEngine.Init();
|
||||
Application.ApplicationExit += Application_ApplicationExit;
|
||||
Application.ApplicationExit += (object sender, EventArgs e) =>
|
||||
{
|
||||
DispEngine.FinishDisp();
|
||||
License.LogOutAll();
|
||||
};
|
||||
|
||||
RenderingCanvas displayer = new RenderingCanvas(new CoordinateDrawing(),new Stl(Box3d.CenterUnitBox).ToFaceDrawing());
|
||||
RenderingCanvas displayer = new RenderingCanvas(
|
||||
new CoordinateDrawing(), new Stl(Box3d.CenterUnitBox).ToFaceDrawing());
|
||||
Form form = new Form();
|
||||
form.Controls.Add(displayer);
|
||||
Application.Run(form);
|
||||
}
|
||||
|
||||
private static void Application_ApplicationExit(object sender, EventArgs e)
|
||||
{
|
||||
DispEngine.FinishDisp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user