private async void LogibBtn_Click(object sender, RoutedEventArgs e) { var localSettings = Current.LocalSettings; var loginSetting = localSettings.Values[loginSettingName]; if (loginSetting == null) { AuthServiceClient client = new AuthServiceClient(); var user = await client.LoginAsync(UserNameTb.Text, PasswordTb.Password); await client.CloseAsync(); if (user == null) { ErrorTb.Text = "Invalid password or name."; return; } Current.LocalSettings.Values[loginSettingName] = user.UserName; } this.Frame.Navigate(typeof(SettingsPage)); }