public void Load() { XmlDocument doc = new XmlDocument(); try { doc.Load(URL); _content.Clear(); XmlElement root = doc.DocumentElement; foreach (XmlElement xmlItem in root.GetElementsByTagName("item")) { WalletItem item = new WalletItem(); DateTime.TryParse(xmlItem.GetAttribute("date"), out item.date); item.data = TradeAnalysation.Load(xmlItem); //bool.TryParse(xmlItem.GetAttribute("buy"), out item.buy); float.TryParse(xmlItem.GetAttribute("share_res"), out item.share[(int)VolumeOwner.RESERVE_BTC]); float.TryParse(xmlItem.GetAttribute("share_spec"), out item.share[(int)VolumeOwner.SPECULATION]); _content.Add(item); } _money.Load(root); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Failed to load wallet!"); Save(); } }
public void Load(XmlElement el) { date = DateTime.Parse(el.GetAttribute("date")); data = TradeAnalysation.Load(el); bool.TryParse(el.GetAttribute("custom"), out custom); bool.TryParse(el.GetAttribute("visible"), out visible); mark.Load((XmlElement)el.GetElementsByTagName("mark")[0]); InitLineList(); int i = 0; foreach (XmlElement e in el.GetElementsByTagName("line")) { lines[i++].Load(e); } }