예제 #1
0
        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);
        }
예제 #2
0
        void refreshlist(int size)
        {
            if (size != (mb.Count + ib.Count))
            {
                tl.RegIndex(ib);
                tl.Subscribe(mb);

                stockslist.Items.Clear();
                for (int i = 0; i < mb.Count; i++)
                {
                    stockslist.Items.Add(mb[i].Name);
                }
                for (int i = 0; i < ib.Count; i++)
                {
                    stockslist.Items.Add(ib[i].Name);
                }
            }
        }