Exemplo n.º 1
0
        void WebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            PeekerStats stats;
            var         sndWbb = (WebBrowser)sender;
            string      strElement;

            try
            {
                Application.DoEvents();

                // Did we get to results page?
                if (e.Url.Host.Contains("playerpeek"))
                {
                    // Did we find any stats for the player?
                    if (e.Url.AbsolutePath.Contains("pokerstars"))
                    {
                        strElement = string.Empty;

                        // Get Html Text for parsing
                        foreach (HtmlElement iHtml in sndWbb.Document.GetElementsByTagName("HTML"))
                        {
                            strElement = iHtml.InnerText;
                        }

                        // Parse Data and put into datagrid
                        stats = new PeekerStats(strElement);

                        // Make sure we didn't add it before, althoug we should never get here
                        // if it is contained already  (see: QueryNextPlayer)
                        if (_queriedStats.ContainsKey(stats.Name.Value))
                        {
                            _queriedStats[stats.Name.Value] = stats;
                        }
                        else
                        {
                            _queriedStats.Add(stats.Name.Value, stats);
                        }

                        AddStatsToGrid(stats);
                    }
                    else
                    {
                        _playersWithoutStats.Add(_newFoundPlayers.ElementAt(_currentIndex));
                    }

                    // Initiate next player search
                    QueryNextPlayer(++_currentIndex);
                }
            }
            catch (Exception excep)
            {
                Log.Error("Unexpected", excep);
            }
        }
Exemplo n.º 2
0
 void AddStatsToGrid(PeekerStats stats)
 {
     dgvStats.Rows.Add(
         stats.Name.ToString(),
         stats.GamesPlayed.ToString(),
         stats.Profit.ToString(),
         stats.AvgProfit.ToString(),
         stats.PercROI.ToString(),
         stats.AvgBuyin.ToString(),
         stats.PercITM.ToString(),
         stats.PercFinalTables.ToString(),
         stats.PercWins.ToString(),
         stats.AvgFinish.ToString(),
         stats.AvgEntrants.ToString());
 }