public void EnsureUpdatedStandings() { var activeProfile = EveLocalChatAnalyser.Properties.ActiveProfile.Default; var hasAPIKey = activeProfile.KeyId > 0 && activeProfile.VCode.Length == VCODE_LENGTH; if (hasAPIKey && (activeProfile.KeyId != activeProfile.LastUpdateKeyId || AreStandingsOutdated(activeProfile))) { if (String.IsNullOrEmpty(activeProfile.CharacterId) || activeProfile.KeyId != activeProfile.LastUpdateKeyId) { var keyIdStr = activeProfile.KeyId.ToString(CultureInfo.InvariantCulture); activeProfile.CharacterId = ApiKeyInfoService.GetCharacterId(keyIdStr, activeProfile.VCode); } DateTime cachedUntil; activeProfile.Standings = EveStandingsApiService.GetStandings( activeProfile.CharacterId.ToString(CultureInfo.InvariantCulture), activeProfile.KeyId, activeProfile.VCode, out cachedUntil); activeProfile.LastUpdateKeyId = activeProfile.KeyId; activeProfile.StandingsCachedUntil = cachedUntil; } }
private void CheckStandingInformation() { var isShowingBlues = !HideBlues.IsChecked.GetValueOrDefault(); if (isShowingBlues) { return; } ActiveProfile.Default.CharacterId = ApiKeyInfoService.GetCharacterId(TxtKeyId.Text, TxtVCode.Text); }