Beispiel #1
0
        private Style SetDefultConnectorGeometryStyle()
        {
            Style _mStaticGeometryStyle = null;
            var   info = this.Info as INodeInfo;

            if (Constraints.Contains(NodeConstraints.ThemeStyle) && info != null && info.Graph.Theme != null)
            {
                DiagramItemStyle style = info.Graph.Theme.GetNodeStyle(ThemeStyleId);
                _mStaticGeometryStyle = new Style()
                {
                    TargetType = typeof(System.Windows.Shapes.Shape),
                };
                _mStaticGeometryStyle.Setters.Add(
                    new Setter()
                {
                    Property = System.Windows.Shapes.Shape.StrokeProperty,
                    Value    = style.Stroke
                });
                _mStaticGeometryStyle.Setters.Add(
                    new Setter()
                {
                    Property = System.Windows.Shapes.Shape.StrokeThicknessProperty,
                    Value    = 1d
                });
            }
            return(_mStaticGeometryStyle);
        }
Beispiel #2
0
        private Style SetDefaultTargetDecoratorStyle()
        {
            Style _mStaticTargetDecoratorStyle = null;
            var   info = this.Info as INodeInfo;

            if (this.Constraints.Contains(NodeConstraints.ThemeStyle) && info != null && info.Graph.Theme != null)
            {
                DiagramItemStyle style = info.Graph.Theme.GetNodeStyle(ThemeStyleId);
                _mStaticTargetDecoratorStyle = new Style()
                {
                    TargetType = typeof(System.Windows.Shapes.Shape),
                };
                _mStaticTargetDecoratorStyle.Setters.Add(
                    new Setter()
                {
                    Property = System.Windows.Shapes.Shape.StrokeProperty,
                    Value    = style.Stroke
                });
                _mStaticTargetDecoratorStyle.Setters.Add(
                    new Setter()
                {
                    Property = System.Windows.Shapes.Shape.FillProperty,
                    Value    = style.Stroke
                });
                _mStaticTargetDecoratorStyle.Setters.Add(
                    new Setter()
                {
                    Property = System.Windows.Shapes.Shape.StrokeThicknessProperty,
                    Value    = 0d
                });
                _mStaticTargetDecoratorStyle.Setters.Add(
                    new Setter()
                {
                    Property = System.Windows.Shapes.Shape.StretchProperty,
                    Value    = Stretch.Fill
                });
                _mStaticTargetDecoratorStyle.Setters.Add(
                    new Setter()
                {
                    Property = FrameworkElement.WidthProperty,
                    Value    = 10d
                });
                _mStaticTargetDecoratorStyle.Setters.Add(
                    new Setter()
                {
                    Property = FrameworkElement.HeightProperty,
                    Value    = 10d
                });
            }
            return(_mStaticTargetDecoratorStyle);
        }
Beispiel #3
0
        private void OnThemeStyleIdChanged()
        {
            var info = this.Info as INodeInfo;

            if (Constraints.Contains(NodeConstraints.ThemeStyle) && info != null && info.Graph.Theme != null)
            {
                if (!string.IsNullOrEmpty(ShapeName) && !ShapeName.Equals("Line"))
                {
                    DiagramItemStyle style = info.Graph.Theme.GetNodeStyle(ThemeStyleId);
                    if (style != null)
                    {
                        foreach (TextAnnotationViewModel annotaiton in (this.Annotations as AnnotationCollection))
                        {
                            annotaiton.Foreground = style.Foreground;
                            annotaiton.FontSize   = (int)style.FontSize;
                            annotaiton.FontFamily = style.FontFamily;
                        }
                    }
                }
            }
        }
Beispiel #4
0
        internal void OnThemeStyleIdChanged()
        {
            var info = this.Info as INodeInfo;

            if (Constraints.Contains(NodeConstraints.ThemeStyle) && (this is Brainstorming.ViewModel.BrainstormingNodeVM) && info != null && info.Graph.Theme != null)
            {
                if (!(this as Brainstorming.ViewModel.BrainstormingNodeVM).ShapeName.Equals("Line"))
                {
                    DiagramItemStyle style = info.Graph.Theme.GetNodeStyle(ThemeStyleId);
                    if (style != null)
                    {
                        foreach (LabelVM annotaiton in (this.Annotations as List <IAnnotation>))
                        {
                            annotaiton.LabelForeground = style.Foreground;
                            annotaiton.FontSize        = (int)style.FontSize;
                            annotaiton.Font            = style.FontFamily;
                        }
                    }
                }
            }
        }
Beispiel #5
0
        public override DiagramItemStyle GenerateStyle(Theme theme, string accent)
        {
            if (this.Name.Equals("Subtly"))
            {
                DiagramItemStyle style = base.GenerateStyle(theme, accent);
                switch (accent)
                {
                case "Accent1":
                    style.Stroke     = ConvertHexToBrush("#e9eff7");
                    style.Foreground = ConvertHexToBrush("#5b9bd5");
                    break;

                case "Accent2":
                    style.Stroke     = ConvertHexToBrush("#ebeff5");
                    style.Foreground = ConvertHexToBrush("#759fcc");
                    break;

                case "Accent3":
                    style.Stroke     = ConvertHexToBrush("#e8ebef");
                    style.Foreground = ConvertHexToBrush("#41719c");
                    break;

                case "Accent4":
                    style.Stroke     = ConvertHexToBrush("#f3f6fa");
                    style.Foreground = ConvertHexToBrush("#bdd0e9");
                    break;

                case "Accent5":
                    style.Stroke     = ConvertHexToBrush("#fbece7");
                    style.Foreground = ConvertHexToBrush("#ed7d31");
                    break;

                case "Accent6":
                    style.Stroke     = ConvertHexToBrush("#ebf1e8");
                    style.Foreground = ConvertHexToBrush("#70ad47");
                    break;

                case "Accent7":
                    style.Stroke     = ConvertHexToBrush("#fef4e7");
                    style.Foreground = ConvertHexToBrush("#fec000");
                    break;
                }
                return(style);
            }
            else if (this.Name.Equals("Refined"))
            {
                DiagramItemStyle style = base.GenerateStyle(theme, accent);
                switch (accent)
                {
                case "Accent1":
                    style.Foreground = ConvertHexToBrush("#5b9bd5");
                    break;

                case "Accent2":
                    style.Foreground = ConvertHexToBrush("#759fcc");
                    break;

                case "Accent3":
                    style.Foreground = ConvertHexToBrush("#41719c");
                    break;

                case "Accent4":
                    style.Foreground = ConvertHexToBrush("#bdd0e9");
                    break;

                case "Accent5":
                    style.Foreground = ConvertHexToBrush("#ed7d31");
                    break;

                case "Accent6":
                    style.Foreground = ConvertHexToBrush("#70ad47");
                    break;

                case "Accent7":
                    style.Foreground = ConvertHexToBrush("#fec000");
                    break;
                }
                return(style);
            }
            else if (this.Name.Equals("Balanced"))
            {
                HsvLinearColorPattern hsvPattern = null;
                Brush foreground = null;
                Brush stroke     = null;
                switch (accent)
                {
                case "Accent1":
                    hsvPattern = generateHSVPattern
                                 (
                        new Point(0, 0), new Point(1, 0), 60, 0.5, 0.5,
                        new List <string>()
                    {
                        "#e9eff7", "#f4f7fb", "#feffff"
                    },
                        new List <double>()
                    {
                        0, 0.24, 0.54
                    }
                                 );
                    foreground = stroke = ConvertHexToBrush("#4f87bb");
                    break;

                case "Accent2":
                    hsvPattern = generateHSVPattern
                                 (
                        new Point(0, 0), new Point(1, 0), 60, 0.5, 0.5,
                        new List <string>()
                    {
                        "#ebeff5", "#f5f7fa", "#feffff"
                    },
                        new List <double>()
                    {
                        0, 0.24, 0.54
                    }
                                 );
                    foreground = stroke = ConvertHexToBrush("#668bb3");
                    break;

                case "Accent3":
                    hsvPattern = generateHSVPattern
                                 (
                        new Point(0, 0), new Point(1, 0), 60, 0.5, 0.5,
                        new List <string>()
                    {
                        "#e8ebef", "#f4f5f7", "#feffff"
                    },
                        new List <double>()
                    {
                        0, 0.24, 0.54
                    }
                                 );
                    foreground = stroke = ConvertHexToBrush("#386288");
                    break;

                case "Accent4":
                    hsvPattern = generateHSVPattern
                                 (
                        new Point(0, 0), new Point(1, 0), 60, 0.5, 0.5,
                        new List <string>()
                    {
                        "#f3f6fa", "#f9fafc", "#feffff"
                    },
                        new List <double>()
                    {
                        0, 0.24, 0.54
                    }
                                 );
                    foreground = stroke = ConvertHexToBrush("#a6b6cd");
                    break;

                case "Accent5":
                    hsvPattern = generateHSVPattern
                                 (
                        new Point(0, 0), new Point(1, 0), 60, 0.5, 0.5,
                        new List <string>()
                    {
                        "#fbece7", "#fdf5f3", "#feffff"
                    },
                        new List <double>()
                    {
                        0, 0.24, 0.54
                    }
                                 );
                    foreground = stroke = ConvertHexToBrush("#d06d29");
                    break;

                case "Accent6":
                    hsvPattern = generateHSVPattern
                                 (
                        new Point(0, 0), new Point(1, 0), 60, 0.5, 0.5,
                        new List <string>()
                    {
                        "#ebf1e8", "#f5f8f4", "#feffff"
                    },
                        new List <double>()
                    {
                        0, 0.24, 0.54
                    }
                                 );
                    foreground = stroke = ConvertHexToBrush("#61973d");
                    break;

                case "Accent7":
                    hsvPattern = generateHSVPattern
                                 (
                        new Point(0, 0), new Point(1, 0), 60, 0.5, 0.5,
                        new List <string>()
                    {
                        "#fef4e7", "#fef9f3", "#feffff"
                    },
                        new List <double>()
                    {
                        0, 0.24, 0.54
                    }
                                 );
                    foreground = stroke = ConvertHexToBrush("#dfa800");
                    break;
                }
                DiagramItemStyle style = base.GenerateStyle(theme, accent);
                if (hsvPattern != null)
                {
                    style.Fill = hsvPattern.GetBrush(theme, accent);
                }
                style.Stroke     = stroke;
                style.Foreground = foreground;
                return(style);
            }
            else if (this.Name.Equals("Moderate"))
            {
                DiagramItemStyle style = base.GenerateStyle(theme, accent);
                style.Foreground = ConvertHexToBrush("#feffff");
                return(style);
            }
            else if (this.Name.Equals("Focused"))
            {
                DiagramItemStyle style = base.GenerateStyle(theme, accent);
                switch (accent)
                {
                case "Accent1":
                    style.Stroke = ConvertHexToBrush("#40709c");
                    break;

                case "Accent2":
                    style.Stroke = ConvertHexToBrush("#547395");
                    break;

                case "Accent3":
                    style.Stroke = ConvertHexToBrush("#2d5171");
                    break;

                case "Accent4":
                    style.Stroke = ConvertHexToBrush("#8a98ab");
                    break;

                case "Accent5":
                    style.Stroke = ConvertHexToBrush("#ae5a21");
                    break;

                case "Accent6":
                    style.Stroke = ConvertHexToBrush("#507e31");
                    break;

                case "Accent7":
                    style.Stroke = ConvertHexToBrush("#ba8c00");
                    break;
                }
                style.Foreground = ConvertHexToBrush("#feffff");
                return(style);
            }
            else if (this.Name.Equals("Intense"))
            {
                DiagramItemStyle style = base.GenerateStyle(theme, accent);
                switch (accent)
                {
                case "Accent1":
                    style.Stroke = ConvertHexToBrush("#40709c");
                    break;

                case "Accent2":
                    style.Stroke = ConvertHexToBrush("#547395");
                    break;

                case "Accent3":
                    style.Stroke = ConvertHexToBrush("#2d5171");
                    break;

                case "Accent4":
                    style.Stroke = ConvertHexToBrush("#8a98ab");
                    break;

                case "Accent5":
                    style.Stroke = ConvertHexToBrush("#ae5a21");
                    break;

                case "Accent6":
                    style.Stroke = ConvertHexToBrush("#507e31");
                    break;

                case "Accent7":
                    style.Stroke = ConvertHexToBrush("#ba8c00");
                    break;
                }
                style.Foreground = ConvertHexToBrush("#feffff");
                return(style);
            }
            else
            {
                return(base.GenerateStyle(theme, accent));
            }
        }