コード例 #1
0
        private static void onNewWorld(object sender, EventArgs a)
        {
            MarketBusinessHourListener listener = null;

            if (_theInstance != null)
            {
                listener = _theInstance.onBusinesStatusChanging;
            }
            _theInstance = (StockCompanyModule)World.world.otherObjects["{227E053A-6667-43fe-8CE2-26EB55CE6A56}"];
            if (_theInstance == null)
            {
                World.world.otherObjects["{227E053A-6667-43fe-8CE2-26EB55CE6A56}"] =
                    _theInstance = new StockCompanyModule();
                Economy.onNewWorld("{227E053A-6667-43fe-8CE4-26EB55CE6A56}");
            }
            else
            {
                Economy.onWorldLoaded("{227E053A-6667-43fe-8CE4-26EB55CE6A56}");
            }
            // restoring listener registrations (may be a BankbookWindow).
            if (listener != null)
            {
                _theInstance.onBusinesStatusChanging = listener;
            }
            _theInstance.rebuildRetainSet();
            // restore registrations for BankbookListHelper
            StocksListHelper.restoreData();
            _theInstance.onTrading = new OwnershipListener(StocksListHelper.onOwnershipStatusChanged);
            Economy.runEconomy();
        }
コード例 #2
0
        public StockMarketForm()
        {
            //
            // Windows フォーム デザイナ サポートに必要です。
            //
            InitializeComponent();
            if (StockMarketConfig.debug)
            {
                this.ClientSize = new Size(850, 381);
            }
            forBuyEdit = new NumberChangeListener(onBuyEditChanged);
            numberBuy.onNumberChanged += forBuyEdit;
            forSellEdit = new NumberChangeListener(onSellEditChanged);
            numberSell.onNumberChanged += forSellEdit;
            numberSell.numberMax        = 0;
            StocksListHelper.buildStockMarketList(listview);
            listener = new AccountListener(onAccountChange);
            AccountManager.onAccountChange += listener;
            onAccountChange();

            chart.chart.ScaleTypeX = XAxisStyle.DAILY;
            chart.setScaleArray(new XAxisStyle[2] {
                XAxisStyle.DAILY, XAxisStyle.MONTHLY
            });
            chart.chart.ScaleTypeY = YAxisStyle.AUTOSCALE;
            chart.chart.area.setYRange(0, 15000);
            //chart.Invalidate();
        }
コード例 #3
0
        public StocksWindow()
        {
            //
            // Windows フォーム デザイナ サポートに必要です。
            //
            InitializeComponent();
            StocksListHelper.buildRetainingList(listview);
            onMarketStatusChanged();

            marketListener = new MarketBusinessHourListener(onMarketStatusChanged);
            market.onBusinesStatusChanging += marketListener;
            chart.chart.ScaleTypeX          = XAxisStyle.DAILY;
            chart.chart.ScaleTypeY          = YAxisStyle.AUTOSCALE;
            chart.chart.area.setYRange(0, 15000);
        }
コード例 #4
0
        private void listview_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            chart.chart.removeDataSourceAt(0);
            if (listview.SelectedItems.Count == 0)
            {
                tl_totStockBuy.Text   = "";
                tl_totStockSell.Text  = "";
                tl_benefit.Text       = "";
                tl_commitionBuy.Text  = "";
                tl_commitionSell.Text = "";
                tl_priceBought.Text   = "";
                tl_totExpense.Text    = "";
                tl_totIncom.Text      = "";
                numberBuy.numberMax   = 0;
                numberSell.numberMax  = 0;
                current = Company.Null;
            }
            else
            {
                ListViewItem item = listview.SelectedItems[0];
                current = (Company)item.Tag;

                int n = current.stockData.numOwn;
                tl_totStockSell.Text = tl_totStockBuy.Text = StocksListHelper.formatNum(n);
                onBuyEditChanged();
                onSellEditChanged();
                tl_benefit.Text     = CurrencyUtil.format(current.stockData.benefitPerStock);
                tl_priceBought.Text = CurrencyUtil.format(current.stockData.averageBoughtPrice);
                numberBuy.numberMax = StockCompanyModule.calcBuyableStocks(
                    current.stockData, AccountManager.theInstance.liquidAssets);
                numberSell.numberMax = current.stockData.numOwn;

                chart.chart.addDataSource(current.stockData, Color.Blue);
            }
            chart.chart.calcRange();
            chart.chart.Invalidate();
        }