Esempio n. 1
0
        protected static void verifyBrushResolvedFromEnumReference(MDBrushEnum wdBrushReference, ref SolidColorBrush _resolvedBrushInstance)
        {
            if (_resolvedBrushInstance != null)
            {
                return;
            }

            var reflectedStaticFieldInfo = typeof(LegacyPalette).GetField(wdBrushReference.ToString(),
                                                                          BindingFlags.Public | BindingFlags.Static);

            if (reflectedStaticFieldInfo == null)
            {
                throw new NotSupportedException($"Could not find a matching static field for the enum identifier " +
                                                $"\'{wdBrushReference}\' in \'LegacyPalette\' class. " +
                                                $"It must be declared as a public static field.");
            }

            var reflectedValue = reflectedStaticFieldInfo.GetValue(null);
            var reflectedBrush = reflectedValue as SolidColorBrush;

            if (reflectedBrush == null)
            {
                throw new NotSupportedException($"The value reflected from LegacyPalette.{wdBrushReference}" +
                                                $"must be not null and must derive from \'System.Windows.Media.SolidColorBrush\'.");
            }

            _resolvedBrushInstance = reflectedBrush;
        }
Esempio n. 2
0
        public MDDarkenExtension(MDBrushEnum mdInitialBrushReference, double darkenOpacity)
        {
            _mdInitialBrushReference = mdInitialBrushReference;

            if (darkenOpacity <= 0 || darkenOpacity >= 1)
            {
                throw new ArgumentOutOfRangeException(nameof(darkenOpacity), darkenOpacity,
                                                      @"The darken opacity value must be >= 0 and <= 1");
            }

            _darkenOpacity = darkenOpacity;
        }
Esempio n. 3
0
        public MDLightenExtension(MDBrushEnum mdInitialBrushReference, double lightenOpacity)
        {
            _mdInitialBrushReference = mdInitialBrushReference;

            if (lightenOpacity <= 0 || lightenOpacity >= 1)
            {
                throw new ArgumentOutOfRangeException(nameof(lightenOpacity), lightenOpacity,
                                                      @"The ligthen opacity value must be >= 0 and <= 1");
            }

            _lightenOpacity = lightenOpacity;
        }
Esempio n. 4
0
        public MDBlendExtension(MDBrushEnum mdInitialBrushReference, double mixinOpacity, MDBrushEnum mdMixedBrushReference)        // : this()
        {
            _mdInitialBrushReference = mdInitialBrushReference;

            if (mixinOpacity <= 0 || mixinOpacity >= 1)
            {
                throw new ArgumentOutOfRangeException(nameof(mixinOpacity), mixinOpacity,
                                                      @"The mixin opacity value must be >= 0 and <= 1");
            }

            _mixinOpacity = mixinOpacity;

            _mdMixedBrushReference = mdMixedBrushReference;
        }