private void btnCreateBinding_Click(object sender, RoutedEventArgs e)
 {
     if (isKeyBinding)
     {
         foreach (string s in soundsToBind)
         {
             KEYBIND newBind = new KEYBIND();
             newBind.keys = keysToBind.ToString();
             var foundID = from snd in soundData.SOUNDs
                           where snd.filePath == s
                           select snd.soundID;
             newBind.soundID = foundID.First();
             soundData.KEYBINDS.Add(newBind);
         }
     }
     else
     {
         foreach (string s in soundsToBind)
         {
             BUTTONBIND newBtnBind = new BUTTONBIND();
             var        foundID    = from snd in soundData.SOUNDs
                                     where snd.filePath == s
                                     select snd.soundID;
             newBtnBind.soundID = foundID.First();
             soundData.BUTTONBINDS.Add(newBtnBind);
         }
     }
     soundData.SaveChanges();
     DialogResult = true;
 }
Exemple #2
0
        private void btnConfirmKeybindEdit_Click(object sender, RoutedEventArgs e)
        {
            KEYBIND editedBind = (from b in soundData.KEYBINDS
                                  where b.bindID == bindIDToChange
                                  select b).First();

            editedBind.keys = keysToBind.ToString();
            soundData.SaveChanges();
            DialogResult = true;
        }
        private void keyBind_Delete(object sender, RoutedEventArgs e)
        {
            KeyBindListing itemToDelete = (KeyBindListing)listViewKeyBinds.SelectedItem;

            if (itemToDelete == null || listViewKeyBinds.SelectedIndex < 1)
            {
                return;
            }
            KEYBIND bindToRemove = (from k in soundData.KEYBINDS
                                    where k.bindID == itemToDelete.KeyBindID
                                    select k).First();

            soundData.KEYBINDS.Remove(bindToRemove);
            soundData.SaveChanges();
            RefreshKeyBindList();
        }