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