Exemplo n.º 1
0
        /// <summary>
        /// Sets up the class varibles also fills volitiliy select and makes sure that the correct buttons are enabled.
        /// </summary>
        /// <param name="a"></param>
        /// <param name="tickers"></param>
        /// <param name="inputHander"></param>
        public MainGUI(EventListener <Error> listener, MainModel_M mm)
        {
            InitializeComponent();

            _mainModel = mm;

            _mainModel.LoadTickersFromFile();
            foreach (Stock_M stock in _mainModel.Stocks)
            {
                uxDUDSelecStock.Items.Add(stock.Tag);
            }

            _eventListener = listener;

            _handler = new MVCEventSystem.EventHandler <Error>();
            _handler.AddEventListener <DisplayEvent>(typeof(DisplayEvent), Update);
            _handler.AddEventListener <PortfolioEvent>(typeof(PortfolioEvent), UpdatePortfolio);



            uxDUDSelecVolatilty.Items.Add("HIGH");
            uxDUDSelecVolatilty.Items.Add("MED");
            uxDUDSelecVolatilty.Items.Add("LOW");
            uxDUDSelecVolatilty.SelectedIndex = 0;

            uxBBuyStock.Enabled  = false;
            uxBSellStock.Enabled = false;

            uxDUDSelecStock.SelectedIndex = 0;

            Update(new DisplayEvent("account"));
        }
Exemplo n.º 2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            MainModel_M mm = new MainModel_M();

            mm.LoadTickersFromFile();
            Controller_C c = new Controller_C(mm);

            MainGUI gui = new MainGUI(c.EventHandle, mm);

            c.RegisterObserver(gui.EventHandler.EventHandle);
            Application.Run(gui);
            // Application.Run(new MainGui());
        }