Example #1
0
        /*****************************************************************************
        *  FUNCTION:  ParseLiveData
        *  Description:
        *  Parameters:
        *          pHtmlData -
        *****************************************************************************/
        private void ParseLiveData(MSHTML.IHTMLDocument2 pHtmlData)
        {
            MSHTML.IHTMLElement2          docBody;
            MSHTML.IHTMLElement2          quoteElement, quoteElement2;
            MSHTML.IHTMLElementCollection searchCollection;
            List <String> values = null;

            try
            {
                docBody = (MSHTML.IHTMLElement2)pHtmlData.body;

                //build the array of column headers
                quoteElement = Helpers.FindHTMLElement(docBody, "div", "id", "quotes_summary_current_data");

                if (quoteElement != null)
                {
                    quoteElement2 = Helpers.FindHTMLElement(quoteElement, "div", "class", "inlineblock");

                    if (quoteElement2 != null)
                    {
                        searchCollection = quoteElement2.getElementsByTagName("span");
                        values           = Helpers.ParseIHTMLElementCollection(searchCollection);

                        this.live_price.Add(double.Parse(values[0]));
                        this.live_chg     = double.Parse(values[1]);
                        this.live_chg_pct = double.Parse(values[2].Replace("%", ""));
                        this.live_timestamps.Add(DateTime.Parse(values[3]));
                    }
                }
            }
            catch (Exception e)
            {
                //TBD
            }
        }