コード例 #1
0
        private void edit_Click(object sender, EventArgs e)
        {
            Keybind toEdit = (Keybind)picker.SelectedItem;

            using (SingleKeybindEditor edit = new SingleKeybindEditor(toEdit))
            {
                edit.ShowDialog();
                ApplyKeybindAfterEditing(edit, true, toEdit);
                edit.Enabled   = false;
                delete.Enabled = false;
            }
        }
コード例 #2
0
        private void delete_Click(object sender, EventArgs e)
        {
            Keybind toDelete = (Keybind)picker.SelectedItem;

            Data.keybinds.DeleteKeybind(toDelete);
            if (Data.keybinds.keybinds.Count == 0)
            {
                edit.Enabled   = false;
                delete.Enabled = false;
            }
            UpdateBox();
        }
コード例 #3
0
 public void ReplaceKeybind(Keybind a, Keybind b)
 {
     Keybind[] arr = keybinds.ToArray();
     for (int i = 0; i < arr.Length; i++)
     {
         Keybind current = arr[i];
         if (current.Equals(a))
         {
             arr[i] = b;
         }
     }
     keybinds = arr.ToList();
 }
コード例 #4
0
        private void deleteButton_Click(object sender, EventArgs e)
        {
            Keybind toDelete = (Keybind)picker.SelectedItem;

            if (toDelete == null)
            {
                return;
            }
            Data.keybinds.DeleteKeybind(toDelete);
            if (Data.keybinds.keybinds.Count == 0)
            {
                editButton.Enabled   = false;
                deleteButton.Enabled = false;
            }
            UpdateBox();
        }
コード例 #5
0
        private void ApplyKeybindAfterEditing(SingleKeybindEditor editor, bool edited, Keybind toReplace)
        {
            if (!editor.confirmed)
            {
                return;
            }
            Keybind kb = editor.keybind;

            if (edited)
            {
                Data.keybinds.ReplaceKeybind(toReplace, kb);
            }
            else
            {
                Data.keybinds.AddKeybind(kb);
            }
            UpdateBox();
        }
コード例 #6
0
 public void DeleteKeybind(Keybind k)
 {
     keybinds.Remove(k);
 }
コード例 #7
0
 public void AddKeybind(Keybind kb)
 {
     keybinds.Add(kb);
 }