// save all global hotkey data from a singular global hotkey to the related row in the global_hotkey table in the database public static void SaveGlobalHotkey(GlobalHotkey globalHotkey) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { cnn.Execute("UPDATE global_hotkey SET (virtual_key_code, modifiers) = (@Virtual_Key_Code, @Modifiers) WHERE id = @Id", globalHotkey); } }
// global hotkeys call this method to play their respective sound files private void OnHotkeyPlaySound(GlobalHotkey hotkey) { // check if the user meant to create a new hotkey command and not execute an existing one if (bHotkeyInProgress) { FinishHotkey(lastSender, hotkey.Key); lastSender = null; return; } int commandIndex = (hotkey.Id - 1) - (numberOfHotkeys * (profiles[profileIndex].Id - 1)); // play the sound file player.Stop(); // stop any previous sounds still playing if (!string.IsNullOrEmpty(commands[commandIndex].File_Path) && // check if a file_path exists for this hotkey !commands[commandIndex].File_Path.Equals("Drop a file here or click to browse.")) { player.Open(new Uri(commands[commandIndex].File_Path)); player.Play(); } }