Exemple #1
0
        private void gotMarketUpdate(MarketWatcher sender, MarketUpdateEventArgs args)
        {
            foreach (MarketSummary sum in args.info)
            {
                foreach (TabPage tp in this.marketTabs.TabPages)
                {
                    if (tp.Name == sum.market)
                    {
                        foreach (Control c in tp.Controls)
                        {
                            if (c.Name == (sum.market + "_PriceLbl"))
                            {
                                c.Invoke(new Action(() => { c.Text = "Price: " + sum.value.ToString(); }));
                            }
                            else if (c.Name == (sum.market + "_DifferenceLbl"))
                            {
                                c.Invoke(new Action(() => { c.Text = "Difference: " + ((sum.difference > 0)?"+" + sum.difference.ToString() + " (↑)":sum.difference.ToString() + " (↓)"); }));
                            }
                            else if (c.Name == (sum.market + "_UpdateTimeLbl"))
                            {
                                c.Invoke(new Action(() => { c.Text = "Last update time: " + args.time.ToString(); }));
                            }
                        }

                        break;
                    }
                }
            }
        }
Exemple #2
0
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            this.InitializeComponent();

            this.addCashTextBox.Text   = "100";
            this.addMarketTextBox.Text = "GOOGL";
            this.offsetCash(100, true);
            this.mw                 = new MarketWatcher(new [] { "OSPTX", "AAPL", "BBY" }, 30000);
            this.markets            = 3;
            this.changedDelay       = false;
            this.watchingMarket     = true;
            this.triedLockingCash   = false;
            this.mw.onMarketUpdate += this.gotMarketUpdate;
            this.stocks             = new Dictionary <String, UInt32>();
        }
Exemple #3
0
 public MainViewModel()
 {
     var watcher = new MarketWatcher();
 }