예제 #1
0
        public virtual void LoadFromXML(XmlElement itemNode, CandleChartControl owner)
        {
            if (itemNode.Attributes["name"] != null) Name = itemNode.Attributes["name"].Value;
            if (itemNode.Attributes["magic"] != null) Magic = itemNode.Attributes["magic"].Value.ToIntSafe() ?? 0;
            if (itemNode.Attributes["color"] != null)
                lineColor = Color.FromArgb(int.Parse(itemNode.Attributes["color"].Value));
            if (itemNode.Attributes["colorFill"] != null)
                ShapeFillColor = Color.FromArgb(int.Parse(itemNode.Attributes["colorFill"].Value));
            if (itemNode.Attributes["alpha"] != null)
                ShapeAlpha = int.Parse(itemNode.Attributes["alpha"].Value);
            if (itemNode.Attributes["type"] != null)
                lineStyle = (TrendLineStyle)int.Parse(itemNode.Attributes["type"].Value);
            if (itemNode.Attributes["pixelScale"] != null)
                PixelScale = itemNode.Attributes["pixelScale"].Value.ToDoubleUniform();
            if (itemNode.Attributes["comment"] != null)
                Comment = itemNode.Attributes["comment"].Value;

            if (itemNode.Attributes["firstX"] != null)
            {
                var time = DateTime.ParseExact(itemNode.Attributes["firstX"].Value, "ddMMyyyy HHmmss",
                                               CultureProvider.Common);
                var index = owner.chart.StockSeries.GetIndexByCandleOpen(time);
                linePoints.Add(new PointD(index, double.Parse(itemNode.Attributes["firstY"].Value,
                    CultureProvider.Common)));
            }

            if (itemNode.Attributes["secondX"] != null)
            {
                var time = DateTime.ParseExact(itemNode.Attributes["secondX"].Value, "ddMMyyyy HHmmss",
                                               CultureProvider.Common);
                var index = owner.chart.StockSeries.GetIndexByCandleOpen(time);
                linePoints.Add(new PointD(index, double.Parse(itemNode.Attributes["secondY"].Value,
                    CultureProvider.Common)));
            }
        }
예제 #2
0
 public TrendLine(TrendLine spc)
 {
     Name = string.Format("Линия {0}", nextLineNum++);
     nextPackmanCurrentFrame++;
     if (nextPackmanCurrentFrame >= packmanFrames.Length)
         nextPackmanCurrentFrame = 0;
     packmanCurrentFrame = nextPackmanCurrentFrame;
     Comment = spc.Comment;
     lineColor = spc.lineColor;
     lineStyle = spc.lineStyle;
     linePoints = spc.linePoints.ToList();
     Owner = spc.Owner;
     penDashStyle = spc.penDashStyle;
     penWidth = spc.penWidth;
     pixelScale = spc.pixelScale;
     selected = spc.selected;
     shapeAlpha = spc.shapeAlpha;
     shapeFillColor = spc.shapeFillColor;
     Comment = spc.Comment;
 }