/// <summary> /// Asynchronously checks that API authentication is valid. /// </summary> public async Task CheckAPIAuthIsValidAsync() { if (m_queryPending) { return; } m_queryPending = true; EveMonClient.Trace("Initiated"); IsAuthenticated = false; SerializableAPIResult <SerializableAPICredentials> result = await CheckAuthenticationAsync().ConfigureAwait(false); IsAuthenticated = !result.HasError && HasCredentialsStored; CredentialsChecked?.ThreadSafeInvoke(this, new CloudStorageServiceProviderEventArgs(result.Error?.ErrorMessage)); m_queryPending = false; var resultText = result.HasError ? "Failed" : "Completed"; EveMonClient.Trace($"CloudStorageServiceProvider.CheckAPIAuthIsValidAsync - {resultText}", printMethod: false); }
/// <summary> /// Asynchronously checks the authentication code. /// </summary> /// <param name="code">The code.</param> public async Task CheckAuthCodeAsync(string code) { if (m_queryPending && AuthSteps == AuthenticationSteps.Two) { return; } m_queryPending = true; EveMonClient.Trace("Initiated"); SerializableAPIResult <SerializableAPICredentials> result = await CheckProviderAuthCodeAsync(code).ConfigureAwait(false); if (!result.HasError) { Settings.Save(); } IsAuthenticated = !result.HasError && HasCredentialsStored; CredentialsChecked?.ThreadSafeInvoke(this, new CloudStorageServiceProviderEventArgs(result.Error?.ErrorMessage)); m_queryPending = false; var actionText = result.HasError ? "Failed" : "Completed"; EveMonClient.Trace($"CloudStorageServiceProvider.CheckAuthCodeAsync - {actionText}", printMethod: false); }