public async Task ShowColor(int keyID, byte r, byte g, byte b) { await this.ConnectionWrapper((deck) => { KeyBitmap bitmap = KeyBitmap.FromRGBColor(r, g, b); deck.SetKeyBitmap(keyID, bitmap); return(Task.FromResult(0)); }); }
private static void Deck_KeyPressed(object sender, KeyEventArgs e) { var d = sender as Client; if (d == null) { return; } if (e.IsDown) { rnd.NextBytes(rgbBuffer); var randomColor = KeyBitmap.FromRGBColor(rgbBuffer[0], rgbBuffer[1], rgbBuffer[2]); d.SetKeyBitmap(e.Key, randomColor); } }
private static void InitDeck(IStreamDeck deck) { deck.SetBrightness(100); deck.ClearKeys(); var bitmap = KeyBitmap.FromFile(@"C:\Users\oddva\Downloads\streamdeck_key.png"); deck.SetKeyBitmap(1, bitmap); var bitmapTBK = KeyBitmap.FromFile(@"C:\Users\oddva\Downloads\tbk.png"); deck.SetKeyBitmap(0, bitmapTBK); var bitmapPanic = KeyBitmap.FromFile(@"C:\Users\oddva\Downloads\power_icon.png"); deck.SetKeyBitmap(4, bitmapPanic); var bitmapCopy1 = KeyBitmap.FromRGBColor(55, 200, 55); deck.SetKeyBitmap(10, bitmapCopy1); var bitmapCopy2 = KeyBitmap.FromRGBColor(255, 200, 55); deck.SetKeyBitmap(11, bitmapCopy2); }
static void Main(string[] args) { //Create some color we use later to draw the flag of austria var red = KeyBitmap.FromRGBColor(237, 41, 57); var white = KeyBitmap.FromRGBColor(255, 255, 255); var rowColors = new KeyBitmap[] { red, white, red }; //Open the Stream Deck device using (var deck = StreamDeck.OpenDevice()) { deck.SetBrightness(100); //Send the bitmap informaton to the device for (int i = 0; i < deck.KeyCount; i++) { deck.SetKeyBitmap(i, rowColors[i / 5]); } Console.ReadKey(); } }
private static KeyBitmap GetRandomColorImage() { rnd.NextBytes(rgbBuffer); return(KeyBitmap.FromRGBColor(rgbBuffer[0], rgbBuffer[1], rgbBuffer[2])); }
private static async void Deck_KeyStateChanged(object sender, KeyEventArgs e) { if (e.IsDown) { switch (e.Key) { case 0: Console.Write(e.Key); Console.WriteLine(" - Trondheim Ballklubb"); break; case 1: Console.Write(e.Key); Console.WriteLine(" - Smiley"); break; case 4: _quitEvent.Set(); break; case 10: string filename; ArrayList selected = new ArrayList(); foreach (SHDocVw.InternetExplorer window in new SHDocVw.ShellWindows()) { filename = Path.GetFileNameWithoutExtension(window.FullName).ToLower(); if (filename.ToLowerInvariant() == "explorer") { Shell32.FolderItems items = ((Shell32.IShellFolderViewDual2)window.Document).SelectedItems(); foreach (Shell32.FolderItem item in items) { selected.Add(item.Path); } } } foreach (var file in selected) { Console.WriteLine(file); } break; case 11: //System.Windows.Clipboard break; case 14: if (sender is IStreamDeck deck) { Console.WriteLine("-----------------------"); for (ushort i = 0; i <= byte.MaxValue; i++) { deck.SetKeyBitmap(14, KeyBitmap.FromRGBColor((byte)i, (byte)(byte.MaxValue - i), (byte)i)); await Task.Delay(10); Console.WriteLine(i); } } break; default: Console.WriteLine(e.Key); break; } } }