Example #1
0
 public void StartTimer(int timeEstimate, string operationType)
 {
     Console.WriteLine("StartTimer entered");
     if (operationType == "FollowerStat")
     {
         FollowerStatsPanel.Invoke((MethodInvoker)(() => {
             FollowerStatTimer.Start();
             FollowerStatProgressLabel.Visible = true;
             TimeSpan timeLeft = TimeSpan.FromSeconds(timeEstimate);
             FollowerStatProgressLabel.Text = "Gathering data from lichess API. Estimated time: " + string.Format("{0:%m}m {0:%s}s", timeLeft);
             apiTimeLeft = timeEstimate;
             databaseTimeLeft = apiTimeLeft / 5;
         }));
     }
     else
     {
         RatingComparatorPanel.Invoke((MethodInvoker)(() => {
             RatingComparatorTimer.Start();
             RatingComparatorProgressLabel.Visible = true;
             TimeSpan timeLeft = TimeSpan.FromSeconds(timeEstimate);
             RatingComparatorProgressLabel.Text = "Gathering data from lichess API. Estimated time: " + string.Format("{0:%m}m {0:%s}s", timeLeft);
             apiTimeLeft = timeEstimate;
             databaseTimeLeft = apiTimeLeft / 4;
         }));
     }
 }
Example #2
0
 /// <summary>
 /// Sets up the results page for the FollowerStats mode
 /// </summary>
 public void SetupFollowerStatPage(string username, string relationship, int followerCount, Link mostActiveLinkRoot, Link mostTvLinkRoot, Link countryLinkRoot, Dictionary <int, int> ratingMap)
 {
     FollowerStatsPanel.Invoke((MethodInvoker)(() => {
         FollowerStatTimer.Stop();
         FollowerStatProgressLabel.Visible = false;
     }));
     FollowerStatsResultsPanel.Invoke((MethodInvoker)(() => {
         FollowerStatsResultsPanel.Visible = true;
         TitleUsernameLabel.Text = char.ToUpper(username[0]) + username.Substring(1) + "'s";
         FollowerStatFollowersLabel.Text = followerCount + " " + relationship;
         string tvOutputString = GetOutputString(mostTvLinkRoot, true, "");
         string timePlayedOutputString = GetOutputString(mostActiveLinkRoot, true, "");
         string countryOutputString = GetOutputString(countryLinkRoot, false, "");
         FollowerStatCountryLabel.Text = "Most popular countries: \n" + countryOutputString;
         TVLabel.Text = "Most time on TV: \n" + tvOutputString;
         TimePlayedLabel.Text = "Most time played: \n" + timePlayedOutputString;
         RatingChart.Series.Clear();
         RatingChart.ChartAreas.Clear();
         RatingChart.Legends.Clear();
         RatingChart.ChartAreas.Add("ChartArea1");
         RatingChart.Series.Add("Frequency");
         foreach (int key in ratingMap.Keys)
         {
             if ((ratingMap[key] != 0 || key < 2000) && relationship == "Followers")
             {
                 RatingChart.Series["Frequency"].Points.AddXY(key, ratingMap[key]);
             }
             else if ((ratingMap[key] != 0 || key > 1400) && relationship == "Following")
             {
                 RatingChart.Series["Frequency"].Points.AddXY(key, ratingMap[key]);
             }
         }
     }));
     ChangePage(4);
 }
Example #3
0
 private void FollowerStatCancelButton_Click(object sender, EventArgs e)
 {
     FollowerStatsPanel.Invoke((MethodInvoker)(() => {
         FollowerStatTimer.Stop();
         FollowerStatProgressLabel.Visible = false;
     }));
     if (CancelButtonHit != null)
     {
         CancelButtonHit();
     }
 }