/// <summary>
        /// Parse - returns an instance converted from the provided string
        /// using the current culture
        /// <param name="source"> string with DoubleCollection data </param>
        /// </summary>
        public static DoubleCollection Parse(string source)
        {
            IFormatProvider formatProvider = System.Windows.Markup.TypeConverterHelper.InvariantEnglishUS;

            TokenizerHelper  th       = new TokenizerHelper(source, formatProvider);
            DoubleCollection resource = new DoubleCollection();

            double value;

            while (th.NextToken())
            {
                value = Convert.ToDouble(th.GetCurrentToken(), formatProvider);

                resource.Add(value);
            }

            return(resource);
        }
Пример #2
0
        static void SetupShape(Shape shape, Brush brush, Pen pen)
        {
            shape.Fill = brush;
            if (pen != null)
            {
                DoubleCollection dashArray = new DoubleCollection();
                foreach (double value in pen.DashArray)
                    dashArray.Add(value);

                shape.Stroke = pen.Brush;
                shape.StrokeThickness = pen.Thickness;
                shape.StrokeDashArray = dashArray;
                shape.StrokeDashOffset = pen.DashOffset;
                shape.StrokeStartLineCap = pen.StartLineCap;
                shape.StrokeEndLineCap = pen.EndLineCap;
                shape.StrokeDashCap = pen.DashCap;
                shape.StrokeLineJoin = pen.LineJoin;
                shape.StrokeMiterLimit = pen.MiterLimit;
            }
        }