diff --git a/RHLauncher.ChangePwd/ChangePwd.cs b/RHLauncher.ChangePwd/ChangePwd.cs index f5b4280..e84fa35 100644 --- a/RHLauncher.ChangePwd/ChangePwd.cs +++ b/RHLauncher.ChangePwd/ChangePwd.cs @@ -63,7 +63,9 @@ namespace RHLauncher private void HandleSendEmailResponse(string response) { - switch (response) + Invoke((MethodInvoker)(() => + { + switch (response) { case "EmailSent": SendEmailButton.Enabled = false; @@ -102,22 +104,25 @@ namespace RHLauncher default: MsgBoxForm.Show("Error:" + response, LocalizedStrings.Error); break; - } + } + })); } private void ResendTimer_Tick(object? sender, EventArgs e) { // Decrement the secondsLeft variable and update the button text secondsLeft--; - TimerLabel.Text = $"({secondsLeft})"; - - // If the timer has finished counting down, stop the timer and enable the ResendEmailButton - if (secondsLeft == 0) + Invoke((MethodInvoker)(() => { - resendTimer.Stop(); - SendEmailButton.Enabled = true; - TimerLabel.Text = ""; - } + TimerLabel.Text = $"({secondsLeft})"; + + if (secondsLeft == 0) + { + resendTimer.Stop(); + SendEmailButton.Enabled = true; + TimerLabel.Text = ""; + } + })); } private async Task VerifyCodeSendRequestAsync() @@ -155,11 +160,12 @@ namespace RHLauncher registryHandler = new RegistryHandler(); registryHandler.ClearPassword(); + Invoke((MethodInvoker)(() => Close())); Application.Restart(); } else { - Close(); + Invoke((MethodInvoker)(() => Close())); } } diff --git a/RHLauncher.LauncherForm/LauncherForm.cs b/RHLauncher.LauncherForm/LauncherForm.cs index f451e88..b8bc30d 100644 --- a/RHLauncher.LauncherForm/LauncherForm.cs +++ b/RHLauncher.LauncherForm/LauncherForm.cs @@ -460,19 +460,24 @@ namespace RHLauncher public void Logout() { - LoginForm? loginForm = Application.OpenForms.OfType().FirstOrDefault(); + LoginForm loginForm = Application.OpenForms.OfType().FirstOrDefault(); if (loginForm != null) { + // Close the current form before restarting + Close(); + + // Restart the application Application.Restart(); } else { - LoginForm newLoginForm = new(); + LoginForm newLoginForm = new LoginForm(); newLoginForm.Show(); Close(); } } + private async void UpdateCheckButton_Click(object sender, EventArgs e) { HidePanels(); diff --git a/RHLauncher.csproj b/RHLauncher.csproj index 0d8e359..6bfc0ab 100644 --- a/RHLauncher.csproj +++ b/RHLauncher.csproj @@ -19,8 +19,8 @@ Launcher Rusty Hearts Launcher x86 - 1.0.2 - 1.0.2 + 1.0.3 + 1.0.3