private async Task CheckAndSave() { try { Settings.Default.sessionid = txtSessionID.Text.Trim(); Settings.Default.steamLogin = txtSteamLogin.Text.Trim(); Settings.Default.steamLoginSecure = txtSteamLoginSecure.Text.Trim(); Settings.Default.myProfileURL = SteamProfile.GetSteamUrl(); Settings.Default.steamparental = txtSteamParental.Text.Trim(); if (await CookieClient.IsLogined()) { Settings.Default.Save(); Close(); return; } } catch (Exception ex) { Logger.Exception(ex, "frmSettingsAdvanced -> CheckAndSave"); } // Invalid cookie data, reset the form btnUpdate.Text = localization.strings.update; txtSessionID.Text = ""; txtSteamLogin.Text = ""; txtSteamLoginSecure.Text = ""; txtSteamParental.Text = ""; txtSessionID.PasswordChar = '\0'; txtSteamLogin.PasswordChar = '\0'; txtSteamLoginSecure.PasswordChar = '\0'; txtSteamParental.PasswordChar = '\0'; txtSessionID.Enabled = true; txtSteamLogin.Enabled = true; txtSteamLoginSecure.Enabled = true; txtSteamParental.Enabled = true; txtSessionID.Focus(); MessageBox.Show(localization.strings.validate_failed); btnUpdate.Enabled = true; }
private async Task CheckAndSave() { try { Settings.Default.sessionid = txtSessionID.Text.Trim(); Settings.Default.steamLogin = txtSteamLogin.Text.Trim(); if (txtSteamLogin.Text.Length > 17) { Settings.Default.myProfileURL = "http://steamcommunity.com/profiles/" + txtSteamLogin.Text.Substring(0, 17); } Settings.Default.steamparental = txtSteamParental.Text.Trim(); if (await CookieClient.IsLogined()) { Settings.Default.Save(); Close(); } } catch (Exception ex) { Logger.Exception(ex, "frmSettingsAdvanced -> CheckAndSave"); } // Invalid cookie data, reset the form btnUpdate.Text = "Update"; txtSessionID.Text = ""; txtSteamLogin.Text = ""; txtSteamParental.Text = ""; txtSessionID.PasswordChar = '\0'; txtSteamLogin.PasswordChar = '\0'; txtSteamParental.PasswordChar = '\0'; txtSessionID.Enabled = true; txtSteamLogin.Enabled = true; txtSteamParental.Enabled = true; txtSessionID.Focus(); MessageBox.Show("The data you've entered isn't valid. Please try again."); btnUpdate.Enabled = true; }