using System; namespace OpenMacroBoard.SDK { /// /// A bunch of extensions to clear all keys, or set a single to all keys. /// public static class SetKeyExtensions { /// /// Sets a background image for all keys /// /// The provided board is null. public static void SetKeyBitmap(this IMacroBoard board, KeyBitmap bitmap) { if (board is null) { throw new ArgumentNullException(nameof(board)); } for (var i = 0; i < board.Keys.Count; i++) { board.SetButtonImage(i, bitmap); } } /// /// Sets background to black for a given key /// /// The provided board is null. public static void ClearKey(this IMacroBoard board, int keyId) { if (board is null) { throw new ArgumentNullException(nameof(board)); } board.SetButtonImage(keyId, KeyBitmap.Black); } /// /// Sets background to black for all given keys /// public static void ClearKeys(this IMacroBoard board) { board.SetKeyBitmap(KeyBitmap.Black); } } }