private void symbox_KeyUp(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { int size = mb.Count + ib.Count; if (Stock.isStock(symbox.Text)) { mb.Add(new Stock(symbox.Text)); } else if (Index.isIdx(symbox.Text)) { ib.Add(new Index(symbox.Text)); } refreshlist(size); } }
private void importbasketbut_Click(object sender, EventArgs e) { OpenFileDialog od = new OpenFileDialog(); od.Multiselect = true; od.Filter = "Basket (*.mb)|*.mb|All files (*.*)|*.*"; od.AddExtension = true; od.DefaultExt = ".mb"; od.CheckFileExists = true; od.Title = "Select the baskets you wish to import to quototpia"; if (od.ShowDialog() == DialogResult.OK) { foreach (string f in od.FileNames) { StreamReader sr = new StreamReader(f); string line = sr.ReadLine(); sr.Close(); string[] r = line.Split(','); int skipped = 0; for (int i = 0; i < r.Length; i++) { bool add = true; if (Stock.isStock(r[i])) { mb.Add(new Stock(r[i])); } else if (Index.isIdx(r[i])) { ib.Add(new Index(r[i])); } else { add = false; skipped++; } if (add) { addsymbol(r[i]); } } status("Imported " + (r.Length - skipped) + " instruments."); } } tl.Subscribe(mb); tl.RegIndex(ib); }