Exemple #1
0
        private async void btnAllStat_Click(object sender, EventArgs e)
        {
            ParseAndVisualize();

            List <Game> games = checkBoxLive.Checked ? _liveGames : _allGames;

            comboBoxPlayers.DataSource = games.GetAllPlayerNames().ToList();
            //Debug.WriteLine("Current thread ID - {0}",Thread.CurrentThread.ManagedThreadId);
            await Task.Run(() =>
            {
                StatOperator statOperator = null;
                if (cbAllStats.Checked)
                {
                    statOperator = new BaseStatOperator(checkBoxLive.Checked, Settings.Default.LiveGamesCount);
                }
                else
                {
                    statOperator = new ConditionalStatOperator(checkBoxLive.Checked);
                }

                //Thread.Sleep(5000);
                var table = statOperator.GetPlayerStatsList(games).ToDataTable();
                //Debug.WriteLine("Current thread ID - {0}", Thread.CurrentThread.ManagedThreadId);
                Invoke((Action) delegate
                {
                    datGrViewAllStats.DataSource = table;
                    MinimizeGridWidth();
                });
            });
        }
Exemple #2
0
        public void FillHud()
        {
            StatOperator sOperator = new ConditionalStatOperator(true);
            var          hudTable  = new HudTable(sOperator, _keyPath);

            hudInfoTxtBx.Text = hudTable.GetHudInfo();
            DrawHeroCards(hudTable);
            DrawMuckCards(hudTable);
            DrawGraphic(hudTable);
            hudGrdVw.DataSource = hudTable.GetPlayerStatsList().ToDataTable();
            MinimizeGridWidth();
        }
Exemple #3
0
        //Оставлен для тестирования и отладки.
        private void btnStatSyncron_Click(object sender, EventArgs e)
        {
            if (_allGames.Count == 0)
            {
                ParseAndVisualize();
            }
            List <Game> games = checkBoxLive.Checked ? _liveGames : _allGames;

            comboBoxPlayers.DataSource = games.GetAllPlayerNames().ToList();

            //start diagnostic --------------------------------------------------------------------------
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            StatOperator statOperator = null;

            if (cbAllStats.Checked)
            {
                statOperator = new BaseStatOperator(checkBoxLive.Checked, Settings.Default.LiveGamesCount);
            }
            else
            {
                statOperator = new ConditionalStatOperator(checkBoxLive.Checked);
            }
            var table = statOperator.GetPlayerStatsList(games).ToDataTable();

            datGrViewAllStats.DataSource = table;
            stopWatch.Stop();
            // Get the elapsed time as a TimeSpan value.
            TimeSpan ts = stopWatch.Elapsed;
            // Format and display the TimeSpan value.
            string elapsedTime = $"Time of statistics estimation - {ts.Milliseconds} ms";

            //end diagnostic ----------------------------------------------------------------------------
            MinimizeGridWidth();
            MessageBox.Show(elapsedTime);
        }