/// <summary> /// Выполняет распечатку данных из AccountList /// </summary> void OrdersTablePrintFromAccountList() { accTable.Children.Clear(); foreach (var el in AccList) { accountRow row_new = new accountRow(); row_new.lblOwner.Content = el.OwnerName; row_new.lblAccNo.Content = el.AccountNumber; row_new.lblAccBal.Content = el.AccountBalance; row_new.lblEURUSD.Content = el.EURUSD.ToString(); row_new.lblGBPUSD.Content = el.GBPUSD.ToString(); row_new.lblGBPJPY.Content = el.GBPGPY.ToString(); row_new.lblUSDCAD.Content = el.USDCAD.ToString(); row_new.lblAUDUSD.Content = el.AUDUSD.ToString(); accTable.Children.Add(row_new); } }
void OrdersTablePrint() { accTable.Children.Clear(); DataTable tableOrders = new DataTable() { TableName = "accounts" }; tableOrders.Columns.Add("Owner"); tableOrders.Columns.Add("Path"); StringReader reader = new StringReader(Properties.Settings.Default.TableXml); tableOrders.ReadXml(reader); for (int i = 0; i < tableOrders.Rows.Count; i++) { accountRow row_new = new accountRow(); accTable.Children.Add(row_new); } int xL = 0; foreach (accountRow el in accTable.Children) { string[] alllines = null; DataRow row = tableOrders.Rows[xL]; el.lblOwner.Content = (string)row["Owner"]; el.lblAccNo.Content = "файла"; el.lblAccBal.Content = "нет"; el.lblEURUSD.Content = "0"; el.lblGBPUSD.Content = "0"; el.lblGBPJPY.Content = "0"; el.lblUSDCAD.Content = "0"; el.lblAUDUSD.Content = "0"; string path = (string)row["Path"]; if (File.Exists(path)) { using (StreamReader sr = new StreamReader(path, Encoding.Default)) { string line; if ((line = sr.ReadLine()) != null) { alllines = line.Split(';'); } el.lblAccNo.Content = alllines[0]; el.lblAccBal.Content = alllines[1]; } for (int i = 2; i < alllines.Length; i++) { string[] sym = alllines[i].Split(':'); if (sym[0] == "EURUSD") { el.lblEURUSD.Content = sym[1]; if (int.Parse(sym[1]) > 0) { el.lblEURUSD.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0)); } else { el.lblEURUSD.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255)); } } if (sym[0] == "GBPUSD") { el.lblGBPUSD.Content = sym[1]; if (int.Parse(sym[1]) > 0) { el.lblGBPUSD.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0)); } else { el.lblGBPUSD.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255)); } } if (sym[0] == "GBPJPY") { el.lblGBPJPY.Content = sym[1]; if (int.Parse(sym[1]) > 0) { el.lblGBPJPY.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0)); } else { el.lblGBPJPY.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255)); } } if (sym[0] == "USDCAD") { el.lblUSDCAD.Content = sym[1]; if (int.Parse(sym[1]) > 0) { el.lblUSDCAD.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0)); } else { el.lblUSDCAD.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255)); } } if (sym[0] == "AUDUSD") { el.lblAUDUSD.Content = sym[1]; if (int.Parse(sym[1]) > 0) { el.lblAUDUSD.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0)); } else { el.lblAUDUSD.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255)); } } } } xL++; } }