Пример #1
0
        public static void OpenChartForm(string ticker, Form Owner, bool NewWindow)
        {
            if (m_idm == null)
            {
                m_idm = new FileDataManager(SymbolForm.GetSymbolTable());
            }
            IDataProvider iDataProvider = m_idm[ticker];


            if (iDataProvider != null)
            {
                var cdp = iDataProvider as CommonDataProvider;
                //    cdp.SetStringData("Code", ticker);
                cdp.Merge(StockDB.GetRealtimeData(ticker));
                if (mCurrentChartForm == null || NewWindow)
                {
                    mCurrentChartForm           = new ChartForm();
                    mCurrentChartForm.MdiParent = Owner;
                    mCurrentChartForm.Show();
                    FormList.Add(mCurrentChartForm);
                }
                mCurrentChartForm.Code = ticker;
                mCurrentChartForm.om.SaveObject(mCurrentChartForm.m_code);
                mCurrentChartForm.ChartControl.Clean();
                mCurrentChartForm.ChartControl.ShowChart(iDataProvider);
                mCurrentChartForm.Activate();
                mCurrentChartForm.om.LoadObject(ticker);
            }
        }
Пример #2
0
        public static void UpdateDateAndOpenChartForm(string code, Form Owner, bool NewWindow)
        {
            YahooDataManager ydm = new YahooDataManager();

            ydm.CacheRoot = FormulaHelper.Root + "Cache";
            CommonDataProvider cdp = new CommonDataProvider(ydm);

            if (mCurrentChartForm == null || NewWindow)
            {
                mCurrentChartForm           = new ChartForm();
                mCurrentChartForm.MdiParent = Owner;
                mCurrentChartForm.Show();
                FormList.Add(mCurrentChartForm);
            }

            mCurrentChartForm.m_code = code;
            mCurrentChartForm.om.SaveObject(mCurrentChartForm.m_code);
            ((ChartWinControl)mCurrentChartForm.om.Canvas).ShowChart(cdp);
            mCurrentChartForm.Activate();
            mCurrentChartForm.om.LoadObject(code);
        }