diff --git a/Steam Desktop Authenticator/MainForm.cs b/Steam Desktop Authenticator/MainForm.cs index 516f0dba..1d3b54e7 100644 --- a/Steam Desktop Authenticator/MainForm.cs +++ b/Steam Desktop Authenticator/MainForm.cs @@ -50,7 +50,7 @@ private void MainForm_Shown(object sender, EventArgs e) if (manifest.Encrypted) { passKey = manifest.PromptForPassKey(); - if(passKey == null) + if (passKey == null) { Application.Exit(); } @@ -307,11 +307,11 @@ private void menuDeactivateAuthenticator_Click(object sender, EventArgs e) private async void menuRefreshSession_Click(object sender, EventArgs e) { bool status = await currentAccount.RefreshSessionAsync(); - if(status == true) + if (status == true) { MessageBox.Show("Your session has been refreshed.", "Session refresh", MessageBoxButtons.OK, MessageBoxIcon.Information); manifest.SaveAccount(currentAccount, manifest.Encrypted, passKey); - } + } else { MessageBox.Show("Failed to refresh your session.\nTry again soon.", "Session refresh", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -419,8 +419,17 @@ private async void timerTradesPopup_Tick(object sender, EventArgs e) foreach (var item in accs) { - Confirmation[] tmp = await currentAccount.FetchConfirmationsAsync(); - confs.AddRange(tmp); + try + { + Confirmation[] tmp = currentAccount.FetchConfirmations(); + confs.AddRange(tmp); + } + catch (SteamGuardAccount.WGTokenInvalidException) + { + lblStatus.Text = "Refreshing session"; + currentAccount.RefreshSession(); //Don't save it to the HDD, of course. We'd need their encryption passkey again. + lblStatus.Text = ""; + } } lblStatus.Text = ""; @@ -490,7 +499,7 @@ private async Task UpdateCurrentSession() { await UpdateSession(currentAccount); } - + private async Task UpdateSession(SteamGuardAccount account) { if (account == null) return;