66 lines
1.3 KiB
C#
66 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Iob.Net.UI
|
|
{
|
|
public partial class IobControlWindow : Form
|
|
{
|
|
#region Private Fields
|
|
|
|
private static IobControlWindow ctrlwindow = null;
|
|
|
|
private bool _closing = false;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Public Constructors
|
|
|
|
public IobControlWindow()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
|
|
|
|
#region Public Methods
|
|
|
|
public static void Start()
|
|
{ // Open WinForm
|
|
Thread th = new Thread(() =>
|
|
{
|
|
Application.EnableVisualStyles();
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
ctrlwindow = new IobControlWindow();
|
|
Application.Run(ctrlwindow);
|
|
});
|
|
|
|
th.SetApartmentState(ApartmentState.STA);
|
|
th.Start();
|
|
}
|
|
|
|
public static void Stop()
|
|
{ // Close WinForm
|
|
if (ctrlwindow != null)
|
|
{
|
|
ctrlwindow.Invoke((ThreadStart)delegate ()
|
|
{
|
|
ctrlwindow._closing = true;
|
|
ctrlwindow.Close();
|
|
ctrlwindow = null;
|
|
});
|
|
}
|
|
}
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |