Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
        private void SymbolForm_KeyDown(object sender, KeyEventArgs e)
        {
            Keys keys1 = e.KeyCode;

            if (keys1 != Keys.Return)
            {
                if (keys1 == Keys.Escape)
                {
                    base.Close();
                    return;
                }
                return;
            }
            if ((this.dgSymbol.CurrentRowIndex < 0) || (this.dgSymbol.CurrentRowIndex >= this.dvSymbol.Count))
            {
                base.Close();
                return;
            }
            string       text1 = this.dgSymbol[this.dgSymbol.CurrentRowIndex, 2].ToString();
            ShortcutType type1 = (ShortcutType)int.Parse(this.dgSymbol[this.dgSymbol.CurrentRowIndex, 0].ToString());

            if (base.Owner is ChartForm)
            {
                switch (type1)
                {
                case ShortcutType.Stock:
                {
                    if (this.dgSymbol.CurrentRowIndex >= 0)
                    {
                        ChartForm.OpenChartForm(text1, base.Owner.MdiParent, false);
                    }
                    if (type1 == ShortcutType.Folder)
                    {
                        ListForm.Current.FolderId = int.Parse(text1);
                        ListForm.Current.Activate();
                    }
                }
                break;

                case ShortcutType.Indicator:
                {
                    (base.Owner as ChartForm).ChartControl.SetAreaByName(text1);
                    if (type1 == ShortcutType.Folder)
                    {
                        ListForm.Current.FolderId = int.Parse(text1);
                        ListForm.Current.Activate();
                    }
                }
                break;
                }
            }
            else if ((base.Owner is ListForm) && (type1 == ShortcutType.Stock))
            {
                ListForm.Current.GotoSymbol(text1);
            }
        }
Exemplo n.º 3
0
 private void OpenChart(int i, bool NewWindow)
 {
     if (StockDB.CurrentList.Count > 0)
     {
         i = (i + StockDB.CurrentList.Count) % StockDB.CurrentList.Count;
         this.dgList.CurrentRowIndex = i;
         string ticker = GetCurrentSelectedSymbol();
         ChartForm.OpenChartForm(ticker, base.MdiParent, NewWindow);
     }
 }
Exemplo n.º 4
0
        private void miUpdate_Click(object sender, EventArgs e)
        {
            YahooDataManager ydm = new YahooDataManager();

            ydm.CacheRoot = FormulaHelper.Root + "Cache";

            ChartForm.DataManager = ydm;
            string code = (string)dgList[dgList.CurrentRowIndex, 1];

            ChartForm.OpenChartForm(code, MainForm.MdiMainForm, true);
        }
Exemplo n.º 5
0
 public bool PreFilterMessage(ref Message m)
 {
     if (m.Msg == 0x100)
     {
         KeyEventArgs args1 = new KeyEventArgs(((Keys)m.WParam.ToInt32()) | Control.ModifierKeys);
         ChartForm.HandleKey(args1);
         if (args1.Handled)
         {
             return(args1.Handled);
         }
     }
     return(false);
 }
Exemplo n.º 6
0
 private void ChartForm_Closed(object sender, EventArgs e)
 {
     FormList.Remove(this);
     if (mCurrentChartForm == this)
     {
         StatisticForm.FreeStatistic();
         if (FormList.Count > 0)
         {
             mCurrentChartForm = (ChartForm)FormList[0];
         }
         else
         {
             mCurrentChartForm = null;
         }
     }
     om.SaveObject(m_code);
 }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
 private void ChartForm_Activated(object sender, EventArgs e)
 {
     mCurrentChartForm = this;
 }