Exemplo n.º 1
0
        private static void ItemForegroundProperty_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ToolboxItem item = d as ToolboxItem;

            if (null == item)
            {
                return;
            }

            switch (item.AssetType)
            {
            case AssetType.Topic:
                Topic.TopicControl topicControl = item.Content as Topic.TopicControl;
                if (topicControl == null)
                {
                    break;
                }
                topicControl.ItemForeground = (SolidColorBrush)e.NewValue;
                break;

            case AssetType.TopicDrag:
                Control.ControlTopicDrag controlTopicDrag = item.Content as Control.ControlTopicDrag;
                if (controlTopicDrag == null)
                {
                    break;
                }
                controlTopicDrag.ItemForeground = (SolidColorBrush)e.NewValue;
                break;

            case AssetType.TextGrid:
                jg.Editor.Library.Control.ControlTextGrid controlTextGrid = item.Content as jg.Editor.Library.Control.ControlTextGrid;
                if (controlTextGrid != null)
                {
                    controlTextGrid.TextForeground = (SolidColorBrush)e.NewValue;
                }
                break;

            case AssetType.Text:
                jg.Editor.Library.Control.ControlTextEditor text = item.Content as jg.Editor.Library.Control.ControlTextEditor;
                if (text != null)
                {
                    text.mainRTB.Selection.ApplyPropertyValue(Run.ForegroundProperty, (SolidColorBrush)e.NewValue);
                }
                break;

            case AssetType.Message:
                jg.Editor.Library.Control.ControlMessage message = item.Content as jg.Editor.Library.Control.ControlMessage;
                if (message != null)
                {
                    message.Foreground = (SolidColorBrush)e.NewValue;
                }
                break;
            }
        }
Exemplo n.º 2
0
        static void ItemBackgroundProperty_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            ControlTopicDrag controlTopicDrag = sender as ControlTopicDrag;

            if (controlTopicDrag == null)
            {
                return;
            }
            foreach (var v in controlTopicDrag.canvas.Children.OfType <ContentControl>())
            {
                Rectangle rectangle2 = Common.FindVisualChild <Rectangle>(v);
                if (rectangle2 != null)
                {
                    rectangle2.Fill = (Brush)e.NewValue;
                }
            }
        }
Exemplo n.º 3
0
        static void ItemForegroundProperty_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            ControlTopicDrag controlTopicDrag = sender as ControlTopicDrag;

            if (controlTopicDrag == null)
            {
                return;
            }

            foreach (var v in controlTopicDrag.canvas.Children.OfType <ContentControl>())
            {
                TextBlock textblock = Common.FindVisualChild <TextBlock>(v);
                if (textblock != null)
                {
                    textblock.Foreground = (Brush)e.NewValue;
                }
            }
        }
Exemplo n.º 4
0
        static void ItemBackgroundAnswerProperty_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            ControlTopicDrag controlTopicDrag = sender as ControlTopicDrag;

            if (controlTopicDrag == null)
            {
                return;
            }

            foreach (var model in controlTopicDrag.canvas.Children.OfType <ControlThumb>())
            {
                Ellipse ellipse = Common.FindVisualChild <Ellipse>(model);
                if (ellipse != null)
                {
                    ellipse.Fill = (Brush)e.NewValue;
                }
                Rectangle rectangle2 = Common.FindVisualChild <Rectangle>(model);
                if (rectangle2 != null)
                {
                    rectangle2.Fill = (Brush)e.NewValue;
                }
            }
        }
Exemplo n.º 5
0
        private static void ItemBackgroundProperty_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ToolboxItem item = d as ToolboxItem;

            if (null == item)
            {
                return;
            }

            switch (item.AssetType)
            {
            case AssetType.Topic:
                Topic.TopicControl topicControl = item.Content as Topic.TopicControl;
                if (topicControl == null)
                {
                    break;
                }
                topicControl.Background = (SolidColorBrush)e.NewValue;
                break;

            case AssetType.TopicDrag:
                Control.ControlTopicDrag controlTopicDrag = item.Content as Control.ControlTopicDrag;
                if (controlTopicDrag == null)
                {
                    break;
                }
                controlTopicDrag.ItemBackground = (SolidColorBrush)e.NewValue;
                break;

            case AssetType.Text:
                ControlTextEditor rtb = item.Content as ControlTextEditor;
                if (rtb != null)
                {
                    rtb.Background = (SolidColorBrush)e.NewValue;
                    rtb.mainRTB.Document.Background = (SolidColorBrush)e.NewValue;
                }
                break;

            case AssetType.TextGrid:

                jg.Editor.Library.Control.ControlTextGrid controlTextGrid = item.Content as jg.Editor.Library.Control.ControlTextGrid;
                if (controlTextGrid != null)
                {
                    controlTextGrid.TextBackground = (SolidColorBrush)e.NewValue;
                }
                break;

            case AssetType.Message:
                jg.Editor.Library.Control.ControlMessage message = item.Content as jg.Editor.Library.Control.ControlMessage;
                if (message != null)
                {
                    message.Background = (SolidColorBrush)e.NewValue;
                }
                break;

            case AssetType.Line:
                jg.Editor.Library.Control.ControlLine controlLine = item.Content as jg.Editor.Library.Control.ControlLine;
                if (controlLine != null)
                {
                    controlLine.Background = (SolidColorBrush)e.NewValue;
                }
                break;
            }
        }