Ejemplo n.º 1
0
 protected override void Show()
 {
     if (_refreshBitmap)
     {
         _bitmap        = BitMapCreator.CreateStreamDeckBitmap(_buttonText, _textFont, _fontColor, _backgroundColor, OffsetX, OffsetY);
         _refreshBitmap = false;
     }
     StreamDeckPanel.GetInstance(StreamDeckInstanceId).SetImage(StreamDeckButtonName, _bitmap);
 }
Ejemplo n.º 2
0
 protected override void DrawBitmap()
 {
     if (string.IsNullOrEmpty(_buttonFinalText))
     {
         return;
     }
     if (_bitmap == null || RefreshBitmap)
     {
         _bitmap       = BitMapCreator.CreateStreamDeckBitmap(_buttonFinalText, _textFont, _fontColor, _backgroundColor, OffsetX, OffsetY);
         RefreshBitmap = false;
     }
 }
Ejemplo n.º 3
0
        public void SetImage(EnumStreamDeckButtonNames streamDeckButtonName, BitmapImage bitmapImage)
        {
            if (streamDeckButtonName == EnumStreamDeckButtonNames.BUTTON0_NO_BUTTON)
            {
                return;
            }
            var keyBitmap = KeyBitmap.Create.FromBitmap(BitMapCreator.BitmapImage2Bitmap(bitmapImage));

            lock (_updateStreamDeckOledLockObject)
            {
                _streamDeckBoard.SetKeyBitmap(StreamDeckCommon.ButtonNumber(streamDeckButtonName) - 1, keyBitmap);
            }
        }
        protected override void DrawBitmap()
        {
            if (_backgroundBitmap == null || _loadBackground)
            {
                _backgroundBitmap = StreamDeckPanel.Validate(_backgroundBitmapPath);
                RefreshBitmap     = true;
            }

            if (_bitmap == null || RefreshBitmap)
            {
                _bitmap       = BitMapCreator.CreateStreamDeckBitmap(ButtonFinalText, TextFont, FontColor, OffsetX, OffsetY, _backgroundBitmap);
                RefreshBitmap = false;
            }
        }
Ejemplo n.º 5
0
        public void SetImage(EnumStreamDeckButtonNames streamDeckButtonName, BitmapImage bitmapImage)
        {
            if (streamDeckButtonName == EnumStreamDeckButtonNames.BUTTON0_NO_BUTTON)
            {
                return;
            }
            var keyBitmap = KeyBitmap.Create.FromBitmap(BitMapCreator.BitmapImage2Bitmap(bitmapImage));

            lock (_updateStreamDeckOledLockObject)
            {
                //EventHandlers.NotifyOledImageChange(this, PanelHash, streamDeckButtonName, BitMapCreator.BitmapImage2Bitmap(bitmapImage));
                _streamDeckBoard.SetKeyBitmap(StreamDeckCommon.ButtonNumber(streamDeckButtonName) - 1, keyBitmap);
            }
        }
Ejemplo n.º 6
0
 protected override void DrawBitmap()
 {
     if (_bitmap == null || RefreshBitmap)
     {
         if (string.IsNullOrEmpty(ButtonFinalText) || !_buttonTextTemplate.Contains(StreamDeckConstants.DCSBIOSValuePlaceHolder))
         {
             _bitmap = BitMapCreator.CreateStreamDeckBitmap(_buttonTextTemplate, _textFont, _fontColor, _backgroundColor, OffsetX, OffsetY);
         }
         else
         {
             _bitmap = BitMapCreator.CreateStreamDeckBitmap(_buttonFinalText, _textFont, _fontColor, _backgroundColor, OffsetX, OffsetY);
         }
         RefreshBitmap = false;
     }
 }
Ejemplo n.º 7
0
        protected override void DrawBitmap()
        {
            if (_bitmap == null || RefreshBitmap)
            {
                _bitmap = StreamDeckPanel.Validate(_imageFile);

                if (BitMapCreator.IsSmallerThanStreamdeckDefault(_bitmap))
                {
                    _bitmap = BitMapCreator.AdjustBitmap(_bitmap, 1.0f, 4.0f, 1.0f);
                    _bitmap = BitMapCreator.EnlargeBitmapCanvas(_bitmap);
                }
                RefreshBitmap = false;
            }

            if (_keyBitmap == null)
            {
                _keyBitmap = KeyBitmap.Create.FromBitmap(_bitmap);
            }
        }
        protected override void DrawBitmap()
        {
            if (_backgroundBitmap == null || _loadBackground)
            {
                _backgroundBitmap = StreamDeckPanel.Validate(_backgroundBitmapPath);
                RefreshBitmap     = true;
            }

            if (_bitmap == null || RefreshBitmap)
            {
                if (string.IsNullOrEmpty(_backgroundBitmapPath)) //User maybe only wants text displayed.
                {
                    _bitmap = BitMapCreator.CreateStreamDeckBitmap(ButtonFinalText, TextFont, FontColor, Color.LightGray, OffsetX, OffsetY);
                }
                else
                {
                    _bitmap = BitMapCreator.CreateStreamDeckBitmap(ButtonFinalText, TextFont, FontColor, OffsetX, OffsetY, _backgroundBitmap);
                }
                RefreshBitmap = true;
            }
        }
Ejemplo n.º 9
0
        private void ShowIdentifyingValue()
        {
            try
            {
                var spins            = 40;
                var random           = new Random();
                var ledPositionArray = Enum.GetValues(typeof(SwitchPanelPZ55LEDPosition));
                var panelColorArray  = Enum.GetValues(typeof(PanelLEDColor));

                while (spins > 0)
                {
                    var bitmap = BitMapCreator.CreateEmptyStreamDeckBitmap(_colors[random.Next(0, 20)]);
                    SetImage(random.Next(0, ButtonCount - 1), bitmap);

                    Thread.Sleep(50);
                    spins--;
                }
            }
            catch (Exception e)
            {
            }
        }