Exemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            BindingList <Quote> customerList = new BindingList <Quote>();

            Quotes = new ObservableCollection <Quote>();

            //Some example tickers
            Quotes.Add(new Quote("AAPL"));
            Quotes.Add(new Quote("SHOP"));
            Quotes.Add(new Quote("WB"));
            Quotes.Add(new Quote("BABA"));

            //get the data
            YahooStockEngine.Fetch(Quotes);

            // Bind the list to the BindingSource.
            this.customersBindingSource.DataSource = Quotes;

            // Attach the BindingSource to the DataGridView.
            this.customersDataGridView.DataSource =
                this.customersBindingSource;
            //poll every 6 seconds
            timer.Interval = new TimeSpan(0, 0, 25);
            timer.Tick    += (o, u) => YahooStockEngine.Fetch(Quotes);

            timer.Start();
        }
        public CardDeckViewModel()
        {
            Quotes = new ObservableCollection <Quote>();

            //Some example tickers
            Quotes.Add(new Quote("AAPL"));
            Quotes.Add(new Quote("SHOP"));
            Quotes.Add(new Quote("WB"));
            Quotes.Add(new Quote("BABA"));

            //get the data
            YahooStockEngine.Fetch(Quotes);

            //poll every 6 seconds
            timer.Interval = new TimeSpan(0, 0, 30);
            timer.Tick    += (o, e) => YahooStockEngine.Fetch(Quotes);

            timer.Start();
        }