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; }
void soundButton_Delete(object sender, RoutedEventArgs e, int bindID) { BUTTONBIND bindToRemove = (from b in soundData.BUTTONBINDS where b.bindID == bindID select b).First(); soundData.BUTTONBINDS.Remove(bindToRemove); soundData.SaveChanges(); RefreshOnScreenButtons(); }