/// <summary> /// Update the site statistics for whatever reason. /// </summary> public void UpdateStats() { ForceUpdateStats = false; _UpdateStats(); StatsUpdated?.Invoke(this, new StatsUpdatedEventArgs(this.Stats)); }
private async void UpdateIntervalTimer_Elapsed(object sender, ElapsedEventArgs e) { foreach (var player in OverwatchPlayers) { if (player.Region != Region.none) { await player.UpdateStats(); } } StatsUpdated?.Invoke(this, e); }
// Detaches from events, stops, and disposes of the dump timer. // Also resets the statistics that were gathered since the creation // of the stat timer. Timers created through the CreateStatTimer // method should be released through this method. private void ReleaseStatTimer(Timer statTimer) { if (statTimer != null) { statTimer.Elapsed -= StatTimer_Elapsed; statTimer.Stop(); statTimer.Dispose(); } // Reset statistics m_measurementCount = 0L; m_lastMeasurementCount = 0L; m_lastTotalBytesReceived = 0L; m_lastStatCalcTime = 0L; StatsUpdated?.Invoke(this, new EventArgs <int, int, float, double>(0, 0, 0.0F, double.NaN)); }
private void Watcher_Changed(object sender, FileSystemEventArgs e) { lock (this) { var previousStats = CurrentStats; CurrentStats = ReadStats(); SessionStats.GamesStarted = CurrentStats.GamesStarted - InitialStats.GamesStarted; SessionStats.GamesFinished = CurrentStats.GamesFinished - InitialStats.GamesFinished; SessionStats.TimesCrewmate = CurrentStats.TimesCrewmate - InitialStats.TimesCrewmate; SessionStats.TimesImpostor = CurrentStats.TimesImpostor - InitialStats.TimesImpostor; SessionStats.CrewmateVoteWins = CurrentStats.CrewmateVoteWins - InitialStats.CrewmateVoteWins; SessionStats.CrewmateTaskWins = CurrentStats.CrewmateTaskWins - InitialStats.CrewmateTaskWins; SessionStats.ImpostorVoteWins = CurrentStats.ImpostorVoteWins - InitialStats.ImpostorVoteWins; SessionStats.ImpostorKillWins = CurrentStats.ImpostorKillWins - InitialStats.ImpostorKillWins; SessionStats.ImpostorSabotageWins = CurrentStats.ImpostorSabotageWins - InitialStats.ImpostorSabotageWins; StatsUpdated?.Invoke(this, new StatusUpdatedEventArgs(previousStats, CurrentStats, SessionStats)); } }
/// <summary> /// Update the site statistics for whatever reason. /// </summary> public void UpdateStats() { _UpdateStats(); StatsUpdated?.Invoke(this, new StatsUpdatedEventArgs(this.Stats)); }