Exemple #1
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            KneeboardSwitch toggleSwitch = Visual as KneeboardSwitch;

            if (toggleSwitch != null)
            {
                switch (toggleSwitch.SwitchPosition)
                {
                case KneeboardSwitchPosition.One:
                    if (toggleSwitch.HasIndicator && toggleSwitch.IndicatorOn && _imageOneIndicatorOn != null)
                    {
                        drawingContext.DrawImage(_imageOneIndicatorOn, _imageRect);
                    }
                    else
                    {
                        drawingContext.DrawImage(_imageOne, _imageRect);
                    }
                    break;

                case KneeboardSwitchPosition.Two:
                    if (toggleSwitch.HasIndicator && toggleSwitch.IndicatorOn && _imageTwoIndicatorOn != null)
                    {
                        drawingContext.DrawImage(_imageTwoIndicatorOn, _imageRect);
                    }
                    else
                    {
                        drawingContext.DrawImage(_imageTwo, _imageRect);
                    }
                    break;

                case KneeboardSwitchPosition.Three:
                    if (toggleSwitch.HasIndicator && toggleSwitch.IndicatorOn && _imageThreeIndicatorOn != null)
                    {
                        drawingContext.DrawImage(_imageThreeIndicatorOn, _imageRect);
                    }
                    else
                    {
                        drawingContext.DrawImage(_imageThree, _imageRect);
                    }
                    break;
                }
            }
        }
Exemple #2
0
        protected override void OnRefresh()
        {
            KneeboardSwitch toggleSwitch = Visual as KneeboardSwitch;

            if (toggleSwitch != null)
            {
                _imageRect.Width     = toggleSwitch.Width;
                _imageRect.Height    = toggleSwitch.Height;
                _imageOne            = ConfigManager.ImageManager.LoadImage(toggleSwitch.PositionOneImage);
                _imageOneIndicatorOn = ConfigManager.ImageManager.LoadImage(toggleSwitch.PositionOneIndicatorOnImage);

                _imageTwo            = ConfigManager.ImageManager.LoadImage(toggleSwitch.PositionTwoImage);
                _imageTwoIndicatorOn = ConfigManager.ImageManager.LoadImage(toggleSwitch.PositionTwoIndicatorOnImage);

                _imageThree            = ConfigManager.ImageManager.LoadImage(toggleSwitch.PositionThreeImage);
                _imageThreeIndicatorOn = ConfigManager.ImageManager.LoadImage(toggleSwitch.PositionThreeIndicatorOnImage);
            }
            else
            {
                _imageOne   = null;
                _imageTwo   = null;
                _imageThree = null;
            }
        }