forked from 2xlbu4u/NativeWorkbench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DebugFormLauncher.cs
55 lines (46 loc) · 1.4 KB
/
DebugFormLauncher.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Threading;
class Program
{
private const int WH_KEYBOARD_LL = 13;
private const int WM_KEYDOWN = 0x0100;
private static NativeWorkbenchForm _nativeWorkbenchForm;
private static IntPtr _hookID = IntPtr.Zero;
private static System.Windows.Forms.Timer _timer;
// private static SimpleCompileForm _simpleCompileForm;
private static void Main(string[] args)
{
var worker = new BackgroundWorker();
worker.DoWork += (sender, e) =>
{
try
{
_nativeWorkbenchForm = new NativeWorkbenchForm();
_timer = new System.Windows.Forms.Timer();
_timer.Stop();
_timer.Interval = 100;
_timer.Tick += _timer_Tick;
_timer.Start();
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
Application.EnableVisualStyles();
Application.Run(_nativeWorkbenchForm);
};
worker.RunWorkerAsync();
Thread.Sleep(-1);
}
static void _timer_Tick(object sender, EventArgs e)
{
_timer.Stop();
if (_nativeWorkbenchForm != null)
_nativeWorkbenchForm.OnTick();
_timer.Start();
}
}