Пример #1
0
        private static void Deck_KeyPressed(object sender, StreamDeckKeyEventArgs e)
        {
            var d = sender as IStreamDeck;

            if (d == null)
            {
                return;
            }

            if (e.IsDown)
            {
                rnd.NextBytes(rgbBuffer);
                var randomColor = StreamDeckKeyBitmap.FromRGBColor(rgbBuffer[0], rgbBuffer[1], rgbBuffer[2]);
                d.SetKeyBitmap(e.Key, randomColor);
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            //Create some color we use later to draw the flag of austria
            var red       = StreamDeckKeyBitmap.FromRGBColor(237, 41, 57);
            var white     = StreamDeckKeyBitmap.FromRGBColor(255, 255, 255);
            var rowColors = new StreamDeckKeyBitmap[] { red, white, red };

            //Open the Stream Deck device
            using (var deck = StreamDeck.FromHID())
            {
                deck.SetBrightness(100);

                //Send the bitmap informaton to the device
                for (int i = 0; i < deck.NumberOfKeys; i++)
                {
                    deck.SetKeyBitmap(i, rowColors[i / 5]);
                }
            }
        }
Пример #3
0
 public StreamDeckKeyBitmap getImage()
 {
     if (ImageType == ImageSaveType.Image_File)
     {
         if (File.Exists(ImageLocation))
         {
             return(StreamDeckKeyBitmap.FromFile(ImageLocation));
         }
         else
         {
             return(StreamDeckKeyBitmap.FromFile("Resources\\default.png"));
         }
     }
     else if (ImageType == ImageSaveType.Image_Color)
     {
         return(StreamDeckKeyBitmap.FromRGBColor(ImageColor.R, ImageColor.G, ImageColor.B));
     }
     else
     {
         return(StreamDeckKeyBitmap.FromRawBitmap(ImageToByte(OpenStreamDeck.Properties.Resources._default)));
     }
 }