예제 #1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            if (!e.Args.Contains("--no-tray"))
            {
                _trayIcon = new TrayIcon(this);
                _trayIcon.Show();
            }

            // Version check updating disabled because this is a fork and it would obviously
            // be bad of us to update this forked version with the original...
            //uxsoft.VersionCheck();

            if (!StartupShortcut.IsRegistered)
            {
                StartupShortcut.Register();
            }

            if (Process.GetProcessesByName(Application.ResourceAssembly.GetName().Name).Length > 1)
            {
                var processes = Process.GetProcessesByName(Application.ResourceAssembly.GetName().Name);
                foreach (Process p in processes)
                {
                    if (p != Process.GetCurrentProcess())
                    {
                        p.Kill();
                    }
                }
            }

            Window = new MainWindow();

            AppleKeyboardHID2.Start();
            AppleKeyboardHID2.KeyDown += new AppleKeyboardHID2.AppleHIDKeyboardEventHandler(AppleKeyboardHID_KeyDown);
            AppleKeyboardHID2.KeyUp   += new AppleKeyboardHID2.AppleHIDKeyboardEventHandler(AppleKeyboardHID_KeyUp);

            if (!e.Args.Contains("--no-bullshit-keys"))
            {
                KeyboardListener.HookedKeys.Add(Key.F2);
                KeyboardListener.HookedKeys.Add(Key.F3);
                KeyboardListener.HookedKeys.Add(Key.F4);
            }
            KeyboardListener.HookedKeys.Add(Key.F7);
            KeyboardListener.HookedKeys.Add(Key.F8);
            KeyboardListener.HookedKeys.Add(Key.F9);
            KeyboardListener.HookedKeys.Add(Key.F10);
            KeyboardListener.HookedKeys.Add(Key.F11);
            KeyboardListener.HookedKeys.Add(Key.F12);
            KeyboardListener.HookedKeys.Add(Key.Back);
            KeyboardListener.HookedKeys.Add(Key.Up);
            KeyboardListener.HookedKeys.Add(Key.Left);
            KeyboardListener.HookedKeys.Add(Key.Right);
            KeyboardListener.HookedKeys.Add(Key.Down);
            KeyboardListener.HookedKeys.Add(Key.Enter);
            KeyboardListener.Register();
            KeyboardListener.KeyDown += new KeyboardListener.KeyHookEventHandler(KeyboardListener_KeyDown);

            Microsoft.Win32.SystemEvents.PowerModeChanged += new Microsoft.Win32.PowerModeChangedEventHandler(SystemEvents_PowerModeChanged);

            Window.Hide();
        }
예제 #2
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            TrayIcon.Show();
            uxsoft.VersionCheck();

            if (!StartupShortcut.IsRegistered)
            {
                StartupShortcut.Register();
            }

            if (Process.GetProcessesByName(Application.ResourceAssembly.GetName().Name).Length > 1)
            {
                var processes = Process.GetProcessesByName(Application.ResourceAssembly.GetName().Name);
                foreach (Process p in processes)
                {
                    if (p != Process.GetCurrentProcess())
                    {
                        p.Kill();
                    }
                }
            }

            Window = new MainWindow();

            AppleKeyboardHID2.Start();
            AppleKeyboardHID2.KeyDown += new AppleKeyboardHID2.AppleHIDKeyboardEventHandler(AppleKeyboardHID_KeyDown);
            AppleKeyboardHID2.KeyUp   += new AppleKeyboardHID2.AppleHIDKeyboardEventHandler(AppleKeyboardHID_KeyUp);

            KeyboardListener.HookedKeys.Add(Key.F2);
            KeyboardListener.HookedKeys.Add(Key.F3);
            KeyboardListener.HookedKeys.Add(Key.F4);
            KeyboardListener.HookedKeys.Add(Key.F7);
            KeyboardListener.HookedKeys.Add(Key.F8);
            KeyboardListener.HookedKeys.Add(Key.F9);
            KeyboardListener.HookedKeys.Add(Key.F10);
            KeyboardListener.HookedKeys.Add(Key.F11);
            KeyboardListener.HookedKeys.Add(Key.F12);
            KeyboardListener.HookedKeys.Add(Key.Back);
            KeyboardListener.HookedKeys.Add(Key.Up);
            KeyboardListener.HookedKeys.Add(Key.Left);
            KeyboardListener.HookedKeys.Add(Key.Right);
            KeyboardListener.HookedKeys.Add(Key.Down);
            KeyboardListener.HookedKeys.Add(Key.Enter);
            KeyboardListener.Register();
            KeyboardListener.KeyDown += new KeyboardListener.KeyHookEventHandler(KeyboardListener_KeyDown);

            Microsoft.Win32.SystemEvents.PowerModeChanged += new Microsoft.Win32.PowerModeChangedEventHandler(SystemEvents_PowerModeChanged);
        }