public SetBindingForm() { InitializeComponent(); RemovedBinding = -1; KeyListener.changeBinding = true; NewBindingSet = false; FormClosing += new FormClosingEventHandler(Cleanup); _currentForm = this; }
private void btnRecordBinding_Click(object sender, EventArgs e) { SetBindingForm setBindingForm = new SetBindingForm(); setBindingForm.BindingType = KeyListener.KeyBinding.Record; setBindingForm.ShowDialog(); if (setBindingForm.NewBindingSet) { btnRecordBinding.Text = ((Keys)Config.CurrentConfig.RecordBinding).ToString(); } MainForm._currentForm.UpdateTip(); }
private void btnOverlayBinding_Click(object sender, EventArgs e) { SetBindingForm setBindingForm = new SetBindingForm(); setBindingForm.BindingType = KeyListener.KeyBinding.ToggleOverlay; setBindingForm.ShowDialog(); if (setBindingForm.NewBindingSet) { btnOverlayBinding.Text = ((Keys)Config.CurrentConfig.ToggleOverlayBinding).ToString(); } }
//Rebind button eventhandler, chooses keyboard binding for button private void BindingDialog(object o, EventArgs e) { int id = Convert.ToInt16(((Button)o).Parent.Name.Substring(3)); SetBindingForm bindingForm = new SetBindingForm(); bindingForm.CurrentButton = id; bindingForm.BindingType = KeyListener.KeyBinding.Sound; bindingForm.ShowDialog(); if (bindingForm.NewBindingSet) { if (bindingForm.RemovedBinding != -1) { Button btn = (Button)Controls.Find("btn" + bindingForm.RemovedBinding, false).First(); btn.Text = ""; } ((Button)((Button)o).Parent).Text = _NEWLINES + ((Keys)SoundProfile.CurrentSoundProfile.Bindings[id]).ToString(); } }