diff --git a/Disp/RenderingForm.cs b/Disp/RenderingForm.cs
index 55bb98b..ce190fc 100644
--- a/Disp/RenderingForm.cs
+++ b/Disp/RenderingForm.cs
@@ -1,91 +1,103 @@
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
{
- ///
- /// A contains .
- /// This class is usually used for debug due to its simplicity.
- ///
- public partial class RenderingForm : Form,IGetDispEngine
- {
- static readonly Form seedForm = new Form();
- private static readonly ConcurrentDictionary displayerMap
- = new ConcurrentDictionary(4, 4);
- ///
- /// See to get the information.
- ///
- public static ConcurrentDictionary DisplayerMap { get => displayerMap; }
- ///
- /// Ctor.
- ///
- /// displayees
- internal RenderingForm(params IDisplayee[] displayees)
- {
- InitializeComponent();
- Displayer = new RenderingCanvas(displayees);
- this.Controls.Add(Displayer);
- //Displayer.DispEngine.Start();
- }
- ///
- /// The contained .
- ///
- public RenderingCanvas Displayer { get; }
- ///
- /// Create and obtain a if the key has not existed; Otherwise, the old one is obtained.
- /// are set to the obtained .
- /// The dictionary of this function is .
- ///
- /// key
- /// The displayees set to the obtained .
- /// A obtained by the key.
- public static RenderingForm Call(string key, params IDisplayee[] displayees)
- {
- if (displayerMap.TryGetValue(key, out RenderingForm f))
- {
- f.Displayer.DispEngine.Displayee = new DispList(displayees);
- return f;
- }
- else
- {
- _ = seedForm.Handle;
- seedForm.Invoke(new Action(() =>
- {
- RenderingForm ff = new RenderingForm(displayees)
- {
- Text = key,
- Visible = true
- };
- displayerMap.TryAdd(key, ff);
- }));
+ ///
+ /// A contains .
+ /// This class is usually used for debug due to its simplicity.
+ ///
+ public partial class RenderingForm : Form, IGetDispEngine
+ {
+ static readonly Form seedForm = new Form();
+ private static readonly ConcurrentDictionary displayerMap
+ = new ConcurrentDictionary(4, 4);
+ ///
+ /// See to get the information.
+ ///
+ public static ConcurrentDictionary DisplayerMap { get => displayerMap; }
+ ///
+ /// Ctor.
+ ///
+ /// displayees
+ internal RenderingForm(params IDisplayee[] displayees)
+ {
+ InitializeComponent();
+ RenderingCanvas = new RenderingCanvas(displayees);
+ this.Controls.Add(RenderingCanvas);
+ //Displayer.DispEngine.Start();
+ }
+ ///
+ /// The contained .
+ ///
+ 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();
+ }
+ }
+ ///
+ /// Create and obtain a if the key has not existed; Otherwise, the old one is obtained.
+ /// are set to the obtained .
+ /// The dictionary of this function is .
+ ///
+ /// key
+ /// The displayees set to the obtained .
+ /// A obtained by the key.
+ public static RenderingForm Call(string key, params IDisplayee[] displayees)
+ {
+ if (displayerMap.TryGetValue(key, out RenderingForm f))
+ {
+ f.RenderingCanvas.DispEngine.Displayee = new DispList(displayees);
+ return f;
+ }
+ else
+ {
+ _ = seedForm.Handle;
+ seedForm.Invoke(new Action(() =>
+ {
+ RenderingForm ff = new RenderingForm(displayees)
+ {
+ Text = key,
+ Visible = true
+ };
+ displayerMap.TryAdd(key, ff);
+ }));
- RenderingForm fff = null;
- while (!displayerMap.TryGetValue(key, out fff))
- Thread.Sleep(1);
- return fff;
- }
- }
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- Displayer.Dispose();
- components.Dispose();
- }
- base.Dispose(disposing);
- }
- ///
- public DispEngine GetDispEngine()
- {
- return Displayer.DispEngine;
- }
- }
+ RenderingForm fff = null;
+ while (!displayerMap.TryGetValue(key, out fff))
+ Thread.Sleep(1);
+ return fff;
+ }
+ }
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ RenderingCanvas.Dispose();
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+ ///
+ public DispEngine GetDispEngine()
+ {
+ return RenderingCanvas.DispEngine;
+ }
+ }
}
diff --git a/Hi.WinForm.csproj b/Hi.WinForm.csproj
index a21a9b6..09c3b32 100644
--- a/Hi.WinForm.csproj
+++ b/Hi.WinForm.csproj
@@ -7,7 +7,7 @@
$(AssemblyName)
x64
WinForm Display module of HiAPI
- 4
+ 13
1.2.$(VersionBuild)
HiAPI
win-x64
diff --git a/Program.cs b/Program.cs
index 70bb274..3a32183 100644
--- a/Program.cs
+++ b/Program.cs
@@ -1,32 +1,35 @@
using Hi.Disp;
using Hi.Disp.Flag;
using Hi.Geom;
+using Hi.Licenses;
using Hi.WinForm.Disp;
using System;
using System.Windows.Forms;
namespace Hi.WinForm
{
- static class Program
- {
- ///
- /// The main entry point for the application.
- ///
- [STAThread]
- static void Main()
- {
- DispEngine.Init();
- Application.ApplicationExit += Application_ApplicationExit;
-
- 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)
+ static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
{
- DispEngine.FinishDisp();
+ License.LogInAll();
+ DispEngine.Init();
+ Application.ApplicationExit += (object sender, EventArgs e) =>
+ {
+ DispEngine.FinishDisp();
+ License.LogOutAll();
+ };
+
+ RenderingCanvas displayer = new RenderingCanvas(
+ new CoordinateDrawing(), new Stl(Box3d.CenterUnitBox).ToFaceDrawing());
+ Form form = new Form();
+ form.Controls.Add(displayer);
+ Application.Run(form);
}
+
}
}