Exemple #1
0
        private void ResetArray()
        {
            byte r = ((Color)newColor.GetValue(SolidColorBrush.ColorProperty)).R;
            byte g = ((Color)newColor.GetValue(SolidColorBrush.ColorProperty)).G;
            byte b = ((Color)newColor.GetValue(SolidColorBrush.ColorProperty)).B;

            for (int i = 0; i < 100; i++)
            {
                ledArray[i] = new LED {
                    redValue = r, greenValue = g, blueValue = b
                };
            }
        }
Exemple #2
0
        public static MaterialIdentity GetIdentity(
            [NotNull] this SolidColorBrush @this)
        {
            @this.IsNotNull(nameof(@this));

            var boxedValue = @this.GetValue(MDH.IdentityProperty);
            var identity   = boxedValue as MaterialIdentity;

            if (boxedValue == null ||
                boxedValue == DependencyProperty.UnsetValue ||
                identity == null)
            {
                return(null);
            }

            return(identity);
        }
Exemple #3
0
        public bool HandleMouseDown(MouseButtonEventArgs e)
        {
            Point pt = e.GetPosition(_drawingCanvas);

            Drawing visual = HitTest(pt);

            if (visual == null)
            {
                if (_tooltip != null)
                {
                    _tooltip.IsOpen     = false;
                    _tooltip.Visibility = Visibility.Hidden;
                }

                return(false);
            }

            if (_selectedVisual != null && visual == _selectedVisual)
            {
                _drawingCanvas.Cursor = Cursors.Hand;

                return(true);
            }

            string itemName = visual.GetValue(FrameworkElement.NameProperty) as string;

            if (itemName == null)
            {
                if (_tooltip != null)
                {
                    _tooltip.IsOpen     = false;
                    _tooltip.Visibility = Visibility.Hidden;
                }

                return(false);
            }
            SolidColorBrush brush = null;

            if (_visualBrushes.ContainsKey(itemName))
            {
                brush = _visualBrushes[itemName] as SolidColorBrush;

                if (brush != null)
                {
                    brush.Color = _colorSelected;
                }
            }
            if (brush == null)
            {
                if (_tooltip != null)
                {
                    _tooltip.IsOpen     = false;
                    _tooltip.Visibility = Visibility.Hidden;
                }

                return(false);
            }
            if (_selectedVisual != null)
            {
                itemName = _selectedVisual.GetValue(FrameworkElement.NameProperty) as string;
                if (itemName == null)
                {
                    return(false);
                }
                if (_visualBrushes.ContainsKey(itemName))
                {
                    brush = _visualBrushes[itemName] as SolidColorBrush;

                    if (brush != null)
                    {
                        brush.Color = _colorLink;
                    }
                }
                else
                {
                    return(false);
                }
            }

            _selectedVisual = visual;

            if (e.ChangedButton == MouseButton.Left)
            {
                string brushName = brush.GetValue(FrameworkElement.NameProperty) as string;
                if (!string.IsNullOrWhiteSpace(brushName))
                {
                    SvgLinkAction linkAction = SvgLink.GetAction(visual);
                    if (linkAction == SvgLinkAction.LinkHtml ||
                        linkAction == SvgLinkAction.LinkPage)
                    {
                        _animator.Start(brushName, brush);
                    }
                }
            }
            else if (e.ChangedButton == MouseButton.Right)
            {
                _animator.Stop();
            }

            return(true);
        }
Exemple #4
0
 internal static object GetColorKey(SolidColorBrush element)
 {
     return(element.GetValue(ColorKeyProperty));
 }