private void Hook() { Unhook(); if (process != null) { globalKey = new GlobalKey(); globalKey.KeyEvent += GlobalKey_KeyEvent; globalMouse = new GlobalMouse(); globalMouse.ButtonEvent += GlobalMouse_ButtonEvent; globalWindow = new GlobalWindow(process); globalWindow.MoveEvent += GlobalWindow_MoveEvent; } }
public static int Main(string[] args) { Log.set_TraceLevel(TraceLevel.Verbose); Application.ThreadException += new ThreadExceptionEventHandler(Program.ApplicationOnThreadException); if (Program.StartForServiceRestart(args)) { return(Program.RestartService()); } if (Program.MigrateSettings(args)) { Program.ExecuteSettingsMigration(); return(0); } if (Program.UpdateLicense(args)) { Program.SendUpdateLicenseMessageToService(); return(0); } Process[] array = Program.FindRunningInstances(); GlobalWindow globalWindow = new GlobalWindow(); Process process = globalWindow.FindInstance(array); if (process != null) { if (Program.StartMinimized(args)) { return(0); } Log.Debug("Activate user instance"); globalWindow.Activate(process); return(0); } else { if (Program.IsAnotherInstanceRunningForCurrentUser()) { Log.Debug("Another instance running for user is detected. Exit."); return(0); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new VpnGuiForm(Program.StartMinimized(args))); return(0); } }
private void Unhook() { if (globalKey != null) { globalKey.KeyEvent -= GlobalKey_KeyEvent; globalKey.Dispose(); globalKey = null; } if (globalMouse != null) { globalMouse.ButtonEvent -= GlobalMouse_ButtonEvent; globalMouse.Dispose(); globalMouse = null; } if (globalWindow != null) { globalWindow.MoveEvent -= GlobalWindow_MoveEvent; globalWindow.Dispose(); globalWindow = null; } }
public override void _Ready() { Instance = this; OS.SetWindowTitle("Rexy's Haunted Bakery"); }