Exemplo n.º 1
0
        void showRealtimeChart()
        {
            if (STATE_SHOWING_REALTIME == mState)
            {
                for (int i = 0; i < mRealtimes.size(); i++)
                {
                    xBaseControl c = (xBaseControl)mRealtimes.elementAt(i);
                    removeControl(c);
                }
                mRealtimes.removeAllElements();
                Invalidate();

                mState = STATE_NORMAL;
                MainApplication.getInstance().setSize(getW(), MINI_H);
            }
            else
            {
                int rW   = getW() / 2;
                int rH   = 200;
                int newH = getH() + rH;
                int x    = 0;
                int y    = MINI_H;

                MainApplication.getInstance().setSize(getW(), newH);

                mState = STATE_SHOWING_REALTIME;
                mTimer.expireTimer();

                RealtimeChart r;
                for (int i = 0; i < 2; i++)
                {
                    stPriceboardStateIndex pi = mContext.mPriceboard.getPriceboardIndexAt(i);
                    if (pi != null && pi.id > 0)
                    {
                        r = new RealtimeChart(mContext.getTradeHistory(pi.id), this);
                        r.setPosition(x + 1, y + 1);
                        r.setSize(rW - 2, rH - 2);
                        addControl(r);

                        mRealtimes.addElement(r);

                        x += rW;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public IndexControl(xIEventListener listener, int marketID, int w, int h)
            : base(listener)
        {
            mMarketID = marketID;
            mContext  = Context.getInstance();
            setSize(w, h);

            //setBackgroundColor(0xffff0000);

            mTab = new xTabControl();
            addControl(mTab);

            mTab.setSize(w, h);

            TabControl tc = (TabControl)mTab.getControl();

            tc.Selected += new TabControlEventHandler(tabControlSelected);

            int y = 0;

            for (int i = 0; i < TAB_TITLE.Length; i++)
            {
                xTabPage page = new xTabPage(TAB_TITLE[i]);
                mTab.addPage(page);

                if (i == 0)
                {
                    stPriceboardStateIndex pi    = mContext.mPriceboard.getPriceboardIndexOfMarket(marketID);
                    TradeHistory           trade = mContext.getTradeHistory(pi.id);

                    //  realtime
                    RealtimeChart rc = new RealtimeChart(trade, this);
                    h = getH() - y;
                    rc.setPosition(0, y);
                    rc.setSize(w, h);
                    page.addControl(rc);

                    mRealtimeChart = rc;
                    mCurrentChart  = mRealtimeChart;
                }
            }

            int currentTab = mContext.getMarketControlTab(mMarketID);

            if (currentTab < 0 || currentTab >= TAB_INDEX.Length)
            {
                currentTab = 0;
            }
            if (currentTab != -1)
            {
                ((TabControl)mTab.getControl()).SelectedIndex = currentTab;

                onPageSelected(currentTab);
            }

            /*
             * //  Do thi phien
             *
             * int[] ids = {ID_ONLINE_CHART, ID_MONEY_CHART, ID_VOLUMN_CHART, ID_HIS_CHART};
             * int x = 0;
             * int y = 0;
             * int bw = (w / 4) - 2;
             * for (int i = 0; i < text.Length; i++)
             * {
             *  bt = xButton.createStandardButton(ids[i], this, text[i], bw);
             *  bt.setPosition(x, 0);
             *
             *  addControl(bt);
             *  x = bt.getRight() + 2;
             *  y = bt.getBottom() + 4;
             * }
             */
        }