Exemplo n.º 1
0
        static public void Bind(string Symbol, Panel pnQuotes, Label lSymbol, Unit width,
                                Label lChangePercentChange, Label lVolume, Label lAverageDailyVolume, Label lDividendYield
                                )
        {
            if (lSymbol == null || lSymbol.Text != Symbol)
            {
                StringBuilder sb = new StringBuilder();
                foreach (Control c in pnQuotes.Controls)
                {
                    if (c is Label)
                    {
                        string s = (c as Label).ID.Substring(1);
                        if (htYahooMap.ContainsKey(s))
                        {
                            sb.Append((string)htYahooMap[s]);
                        }
                    }
                }

                string r = YahooDataManager.TryDownloadRealtimeFromYahoo(Symbol, sb.ToString());

                if (r != null)
                {
                    string[] rr = r.Trim().Split('\r');
                    if (rr.Length > 0)
                    {
                        BindData(rr[0], pnQuotes, lChangePercentChange, lVolume, lAverageDailyVolume, lDividendYield);
                    }
                }
            }
            pnQuotes.Width = width;
        }
Exemplo n.º 2
0
        private void Bind()
        {
            Control tbSymbol = Parent.FindControl(symbolControl);

            if (tbSymbol is TextBox)
            {
                string Symbol = (tbSymbol as TextBox).Text;
                if (lSymbol.Text != Symbol)
                {
                    StringBuilder sb = new StringBuilder();
                    foreach (Control c in pnQuotes.Controls)
                    {
                        if (c is Label)
                        {
                            string s = (c as Label).ID.Substring(1);
                            if (htYahooMap.ContainsKey(s))
                            {
                                sb.Append((string)htYahooMap[s]);
                            }
                        }
                    }

                    string r = YahooDataManager.TryDownloadRealtimeFromYahoo(Symbol, sb.ToString());

                    if (r != null)
                    {
                        string[] rr = r.Trim().Split('\r');
                        if (rr.Length > 0)
                        {
                            BindData(rr[0]);
                        }
                    }
                }
            }
            pnQuotes.Width = width;
        }