示例#1
0
        private Color OverrideImageColor(PaletteState state)
        {
            // We are only interested in overriding the normal and disabled colors
            if ((state == PaletteState.Normal) ||
                (state == PaletteState.Disabled))
            {
                // ReSharper disable RedundantBaseQualifier
                // Get the color map from the button spec
                Color mapColor = _buttonSpec.GetColorMap(base.Target);
                // ReSharper restore RedundantBaseQualifier

                // If we are supposed to remap a color
                if (mapColor != Color.Empty)
                {
                    // ReSharper disable RedundantBaseQualifier
                    // Get the button style requested
                    ButtonStyle buttonStyle = _buttonSpec.GetStyle(base.Target);
                    // ReSharper restore RedundantBaseQualifier

                    // If we are checking for button styles of ButtonSpec only, then do so
                    if (buttonStyle == ButtonStyle.ButtonSpec)
                    {
                        return(mapColor);
                    }
                }
            }

            return(Color.Empty);
        }
示例#2
0
        private Color OverrideImageColor(PaletteState state)
        {
            // We only intercept if we have a content to use for redirection
            if (PaletteContent != null)
            {
                // We only override the normal/disabled states
                if (state is PaletteState.Normal or PaletteState.Disabled)
                {
                    // ReSharper disable RedundantBaseQualifier
                    // Get the color map from the button spec
                    Color mapColor = _buttonSpec.GetColorMap(base.Target);
                    // ReSharper restore RedundantBaseQualifier

                    // If we are supposed to remap a color
                    if (mapColor != Color.Empty)
                    {
                        // ReSharper disable RedundantBaseQualifier
                        // Get the button style requested
                        ButtonStyle buttonStyle = _buttonSpec.GetStyle(base.Target);
                        // ReSharper restore RedundantBaseQualifier

                        // Only for ButtonSpec do we use the palette value
                        if (buttonStyle == ButtonStyle.ButtonSpec)
                        {
                            return(mapColor);
                        }
                    }
                }
            }

            return(Color.Empty);
        }