Esempio n. 1
0
        // CONSTRUKTOR
        public SettingsForm()
        {
            InitializeComponent();

            if (!NetworkBit)
            {
                ipAddressTB.Visible = false;
                toNetworkCB.Visible = false;
            }
            if (!ManageNetworkBit)
            {
                remoteControlCB.Visible   = false;
                ignoreBroadcastCB.Visible = false;
                remoteControl             = true;
                ignoreBroadcast           = false;
            }


            SoundClass.ClearHotkeys();
            for (int i = 0; i < 12; i++)
            {
                SoundClass.SetHotkey(new Hotkey("Control + Shift + F" + (i + 1)));
            }

            LoadSettings();

            SoundClass.Form = this;

            play_timer.Tick += new EventHandler(play_timer_Tick);

            if (!Program.debugmode)
            {
                this.WindowState = FormWindowState.Minimized;
            }

            Initialized = true;

            SaveSettings(false);

            NetworkClass.StartReceiving();

            KeyWatcher.ButtonPushed += new KeyWatcher.ButtonPushedEventHandler(ButtonPushedEvent);
        }
Esempio n. 2
0
        public static void PushedButtons(int keyCode)
        {
            if (Program.debugmode)
            {
                String realPressed = "";
                realPressed += "vkCode: " + keyCode + " \n";
                realPressed += "Key: " + (Keys)keyCode + " \n";
                realPressed += "ModifierKeys: " + Control.ModifierKeys + " \n";
                Console.WriteLine(realPressed);
            }

            Keys   key         = (Keys)keyCode;
            Hotkey pressedKeys = new Hotkey();

            if (Control.ModifierKeys.ToString().Contains(Keys.Control.ToString()))
            {
                pressedKeys.Add(Keys.Control);
            }
            if (Control.ModifierKeys.ToString().Contains(Keys.Shift.ToString()))
            {
                pressedKeys.Add(Keys.Shift);
            }
            if (Control.ModifierKeys.ToString().Contains(Keys.Alt.ToString()))
            {
                pressedKeys.Add(Keys.Alt);
            }

            bool doNotAdd = false;

            if (key.ToString().Contains(Keys.Control.ToString()))
            {
                doNotAdd = true;
            }
            if (key.ToString().Contains(Keys.Shift.ToString()))
            {
                doNotAdd = true;
            }
            if (key.ToString().Contains(Keys.Alt.ToString()))
            {
                doNotAdd = true;
            }

            if (!doNotAdd)
            {
                pressedKeys.Add(key);
            }

            /* HARD CODED EXIT COMBO */
            Hotkey exitCombo = new Hotkey("Control + Shift + Alt + Delete");

            if (pressedKeys.Equals(exitCombo))
            {
                SettingsForm.forceClose = true;
                Application.Exit();
            }
            /* HARD CODED EXIT COMBO */

            ButtonPushed(pressedKeys);

            for (int i = 0; i < SoundClass.HotkeyCount; i++)
            {
                if (pressedKeys.Equals(SoundClass.GetHotkey(i)))
                {
                    if (SettingsForm.ToNetwork)
                    {
                        NetworkClass.Send(i.ToString());
                    }
                    else
                    {
                        if (NetworkClass.hardPlay && Program.godmode)
                        {
                            SoundClass.HardPlay(i);
                        }
                        else
                        {
                            SoundClass.Play(i);
                        }
                    }
                }
            }

            if (Program.debugmode)
            {
                Console.WriteLine(pressedKeys.ToString());
            }
        }