public static void SaveStyleToFile() { TradeClientStyle style = new TradeClientStyle(); style.InitValueFromCommonStaticMemeber(); XmlSerializer ser = new XmlSerializer(typeof(TradeClientStyle)); TextWriter writer = new StreamWriter(STYLE_FILE_PATH); ser.Serialize(writer, style); writer.Close(); }
public void DeepCopy(TradeClientStyle style) { this.Cb_consultIndex = style.Cb_consultIndex; this.ChangeColor = style.ChangeColor; this.UpColor = style.UpColor; this.DownColor = style.DownColor; this.LabelHQContentForeground = style.LabelHQContentForeground; this.LabelHQContentBackground = style.LabelHQContentBackground; this.LabelHQHeaderForeground = style.LabelHQHeaderForeground; this.LabelHQHeaderBackground = style.LabelHQHeaderBackground; this.LabelHQSelectedForeground = style.LabelHQSelectedForeground; this.LabelHQSelectedBackground = style.LabelHQSelectedBackground; this.HQOddColor = style.HQOddColor; this.HQEvenColor = style.HQEvenColor; this.CodeColor = style.CodeColor; this.HQFontFamily = style.HQFontFamily; this.HQFontSize = style.HQFontSize; this.HQFontStyle = style.HQFontStyle; this.HQFontWeight = style.HQFontWeight; this.HQHeaderFontFamily = style.HQHeaderFontFamily; this.HQHeaderFontSize = style.HQHeaderFontSize; this.HQHeaderFontStyle = style.HQHeaderFontStyle; this.HQHeaderFontWeight = style.HQHeaderFontWeight; this.LabelOtherContentForeground = style.LabelOtherContentForeground; this.LabelOtherContentBackground = style.LabelOtherContentBackground; this.LabelOtherHeaderForeground = style.LabelOtherHeaderForeground; this.LabelOtherHeaderBackground = style.LabelOtherHeaderBackground; this.LabelOtherSelectedForeground = style.LabelOtherSelectedForeground; this.LabelOtherSelectedBackground = style.LabelOtherSelectedBackground; this.OtherOddColor = style.OtherOddColor; this.OtherEvenColor = style.OtherEvenColor; this.OtherFontFamily = style.OtherFontFamily; this.OtherFontSize = style.OtherFontSize; this.OtherFontStyle = style.OtherFontStyle; this.OtherFontWeight = style.OtherFontWeight; this.OtherHeaderFontFamily = style.OtherHeaderFontFamily; this.OtherHeaderFontSize = style.OtherHeaderFontSize; this.OtherHeaderFontStyle = style.OtherHeaderFontStyle; this.OtherHeaderFontWeight = style.OtherHeaderFontWeight; this.HQRowHeight = style.HQRowHeight; this.OtherRowHeight = style.OtherRowHeight; this.OtherCellBorder = style.OtherCellBorder; }
private static void LoadStyleFromFile(string filePath) { if (File.Exists(filePath)) { XmlSerializer ser = new XmlSerializer(typeof(TradeClientStyle)); System.IO.FileStream fs = new System.IO.FileStream(filePath, FileMode.Open); System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(fs); TradeClientStyle style = null; try { style = (TradeClientStyle)(ser.Deserialize(reader)); reader.Close(); fs.Close(); } catch (Exception ex) { Util.Log_Error("exception: " + ex.Message); Util.Log_Error(ex.StackTrace); } style.UpdateToCommonStaticMemeber(); } }