/// <summary> /// сохранить в файл /// </summary> public void Save() { try { using (StreamWriter writer = new StreamWriter(@"Engine\Color\" + _name + "Color.txt")) { writer.WriteLine(ColorUpBodyCandle.ToArgb()); writer.WriteLine(ColorUpBorderCandle.ToArgb()); writer.WriteLine(ColorDownBodyCandle.ToArgb()); writer.WriteLine(ColorDownBorderCandle.ToArgb()); writer.WriteLine(ColorBackSecond.ToArgb()); writer.WriteLine(ColorBackChart.ToArgb()); writer.WriteLine(ColorBackCursor.ToArgb()); writer.WriteLine(ColorText.ToArgb()); } if (NeedToRePaintFormEvent != null) { NeedToRePaintFormEvent(); } } catch (Exception error) { SendNewMessage(error.ToString(), LogMessageType.Error); } }
public void SaveInXML(XmlElement parentNode, CandleChartControl owner) { var node = parentNode.AppendChild(parentNode.OwnerDocument.CreateElement("Comment")); var attrName = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Name")); attrName.Value = Name; var attrText = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Text")); attrText.Value = Text; var attrColor = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Color")); attrColor.Value = color.ToArgb().ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ColorText")).Value = ColorText.ToArgb().ToString(); var attrPivotPrice = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("PivotPrice")); attrPivotPrice.Value = PivotPrice.ToString(CultureProvider.Common); var attrPivotTime = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("PivotTime")); attrPivotTime.Value = owner.chart.StockSeries.GetCandleOpenTimeByIndex((int)Math.Round(PivotIndex)).ToString( "ddMMyyyy HHmmss", CultureProvider.Common); var attrArrowLength = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ArrowLength")); attrArrowLength.Value = ArrowLength.ToString(); var attrArrowAngle = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ArrowAngle")); attrArrowAngle.Value = ArrowAngle.ToString(CultureProvider.Common); var attrHideArrow = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("HideArrow")); attrHideArrow.Value = HideArrow.ToString(); var attrHideBox = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("HideBox")); attrHideBox.Value = HideBox.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("DrawFrame")).Value = DrawFrame.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ColorFill")).Value = ColorFill.ToArgb().ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("FillTransparency")).Value = FillTransparency.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("TextCustom")).Value = TextCustom; node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("magic")).Value = Magic.ToString(); }
public void SaveInXML(XmlElement parentNode, CandleChartControl owner) { var node = parentNode.AppendChild(parentNode.OwnerDocument.CreateElement("Asterisk")); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Name")).Value = Name; node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Text")).Value = Text; node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Sign")).Value = Sign; node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("magic")).Value = Magic.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ColorLine")).Value = ColorLine.ToArgb().ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ColorFill")).Value = ColorFill.ToArgb().ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ColorText")).Value = ColorText.ToArgb().ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Price")).Value = Price.ToString(CultureProvider.Common); if (DateStart.HasValue) { node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("PivotTime")).Value = DateStart.Value.ToString("ddMMyyyy HHmmss", CultureProvider.Common); } node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Shape")).Value = Shape.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Transparency")).Value = Transparency.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("TransparencyText")).Value = TransparencyText.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Radius")).Value = Radius.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("magic")).Value = Magic.ToString(); }