Exemplo n.º 1
0
 /// <summary>
 /// Stop Timer Button
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Stopbtn_Click(object sender, RoutedEventArgs e)
 {
     RunManager.StopButtonClick();
 }
Exemplo n.º 2
0
        private IntPtr HwndHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            const int WM_HOTKEY = 0x0312;

            if (setHotkeyState != 0)
            {
                Key k = Hotkeys.IsKeyDown();
                if (k == Key.Escape)
                {
                    switch (setHotkeyState)
                    {
                    case 1:
                        set_split_key.Content = "Not set";
                        break;

                    case 2:
                        set_start_key.Content = "Not set";
                        break;

                    case 3:
                        set_reset_key.Content = "Not set";
                        break;
                    }
                    setHotkeyState = 0;
                }
                if (k != Key.None)
                {
                    Debug.WriteLine("Pressed key: " + k.ToString());

                    switch (setHotkeyState)
                    {
                    case 1:
                        UnregisterHotKey(Hotkeys.SplitID);
                        KeyConfig.Config.SplitHK = (uint)KeyInterop.VirtualKeyFromKey(k);
                        RegisterHotKey(KeyConfig.Config.SplitHK, Hotkeys.SplitID);
                        set_split_key.Content = k.ToString();
                        break;

                    case 2:
                        UnregisterHotKey(Hotkeys.StartID);
                        KeyConfig.Config.StartHK = (uint)KeyInterop.VirtualKeyFromKey(k);
                        RegisterHotKey(KeyConfig.Config.StartHK, Hotkeys.StartID);
                        set_start_key.Content = k.ToString();
                        break;

                    case 3:
                        UnregisterHotKey(Hotkeys.ResetID);
                        KeyConfig.Config.ResetHK = (uint)KeyInterop.VirtualKeyFromKey(k);
                        RegisterHotKey(KeyConfig.Config.ResetHK, Hotkeys.ResetID);
                        set_reset_key.Content = k.ToString();
                        break;
                    }

                    setHotkeyState = 0;
                }
            }
            switch (msg)
            {
            case WM_HOTKEY:
                switch (wParam.ToInt32())
                {
                case 9000:

                    if (SPLT.LoadedGame != null)
                    {
                        if (!runInProgress)
                        {
                            RunManager.TimerStart();
                        }
                        else
                        {
                            RunManager.Split();
                        }
                    }


                    handled = true;
                    break;

                case 9001:
                    if (SPLT.LoadedGame != null)
                    {
                        if (!runInProgress)
                        {
                            RunManager.TimerStart();
                        }
                        else
                        {
                            RunManager.StopButtonClick();
                        }
                    }

                    break;

                case 9002:
                    if (SPLT.LoadedGame != null)
                    {
                        RunManager.Reset();
                    }

                    break;
                }
                break;
            }
            return(IntPtr.Zero);
        }