private void RedeemWorker_DoWork(object sender, DoWorkEventArgs e) { string Username = null, SerialKey = null; Dispatcher.Invoke(() => { Username = UsernameBox.Text; SerialKey = SerialKeyBox.Text; }); WebInterface.VerifyWebsite(this); var Result = WebInterface.Redeem(Username, SerialKey); switch (Result) { case WebInterface.RedeemResult.OK: { Dispatcher.Invoke(() => { MessageBox.Show( "You have succesfully redeemed a key to your Synapse account!\n\nYou can now restart Synapse X and login to use the software.", "Synapse X", MessageBoxButton.OK, MessageBoxImage.Information); }); Environment.Exit(0); break; } case WebInterface.RedeemResult.ALREADY_UNLIMITED: { Dispatcher.Invoke(() => { MessageBox.Show( "Your account is already unlimited. This should not happen, please contact 3dsboy08 on Discord.", "Synapse X", MessageBoxButton.OK, MessageBoxImage.Error); RedeemButton.Content = "Redeem"; }); return; } case WebInterface.RedeemResult.INVALID_KEY: { Dispatcher.Invoke(() => { MessageBox.Show( "Invalid serial key.", "Synapse X", MessageBoxButton.OK, MessageBoxImage.Error); RedeemButton.Content = "Redeem"; }); break; } case WebInterface.RedeemResult.INVALID_USERNAME: { Dispatcher.Invoke(() => { MessageBox.Show( "Invalid username. This should not happen, please contact 3dsboy08 on Discord.", "Synapse X", MessageBoxButton.OK, MessageBoxImage.Error); RedeemButton.Content = "Redeem"; }); break; } default: { Dispatcher.Invoke(() => { MessageBox.Show( "Failed to redeem to account. Please contact 3dsboy08 on Discord.", "Synapse X", MessageBoxButton.OK, MessageBoxImage.Error); RedeemButton.Content = "Redeem"; }); break; } } }