private void Form1_FormClosing(object sender, FormClosingEventArgs e) { KeyboardUtilities.Disconnect(); hkm.Enabled = false; ArrayList tmp = new ArrayList(); foreach (GlobalHotKey a in hkm.EnumerateGlobalHotKeys) { tmp.Add(a); } foreach (GlobalHotKey VARIABLE in tmp) { hkm.RemoveGlobalHotKey(VARIABLE); } hkm.Dispose(); if (a != null) { if (a.f != null) { a.f.Dispose(); RainbowMage.HtmlRenderer.Renderer.Shutdown(); } } StopKeyPlay(); timeEndPeriod(1); }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { hotKeyManager.Unregister(_hotKeyF10); hotKeyManager.Unregister(_hotKeyF12); // Dispose the hotkey manager. hotKeyManager.Dispose(); KeyboardUtilities.Disconnect(); }
private void btnKeyboardConnect_Click(object sender, EventArgs e) { if (cbMidiKeyboard.SelectedItem != null) { if (cbMidiKeyboard.Enabled) { if (KeyboardUtilities.Connect(cbMidiKeyboard.SelectedIndex) == 0) { cbMidiKeyboard.Enabled = false; btnKeyboardConnect.BackgroundImage = Resources.btn2; } } else { KeyboardUtilities.Disconnect(); cbMidiKeyboard.Enabled = true; cbMidiKeyboard.DataSource = KeyboardUtilities.GetKeyboardList(); btnKeyboardConnect.BackgroundImage = Resources.btn1; } } }
private void btnKeyboardConnect_Click(object sender, EventArgs e) { if (cbMidiKeyboard.SelectedItem != null) { if (cbMidiKeyboard.Enabled) { if (KeyboardUtilities.Connect(cbMidiKeyboard.SelectedItem.ToString(), kc) == 0) { cbMidiKeyboard.Enabled = false; btnKeyboardConnect.BackColor = Color.Aquamarine; } } else { KeyboardUtilities.Disconnect(); cbMidiKeyboard.Enabled = true; cbMidiKeyboard.DataSource = KeyboardUtilities.GetKeyboardList(); btnKeyboardConnect.BackColor = Color.FromArgb(255, 110, 128); } } }