/// <summary> /// Gets the profiles for the user /// </summary> /// <returns></returns> public async Task GetProfilesAsync() { IsBusy = true; // Call the api and get some data! try { var resp = await KryptPadApi.GetProfilesAsync(); // Create instance to credential locker var locker = new PasswordVault(); // Clear the profiles list Profiles.Clear(); // Add the profiles to the list foreach (var profile in resp.Profiles) { var profileModel = new ProfileModel(profile) { WindowsHelloEnabled = HasSavedPassphrase(locker, profile.Id.ToString()) }; // Add profile to list Profiles.Add(profileModel); } // Set the selected profile. // TODO: Make this restore last selected profile... somehow //SelectedProfile = Profiles.FirstOrDefault(); // If we don't have any profiles, hide the selection ProfileSelectionVisible = Profiles.Any() ? Visibility.Visible : Visibility.Collapsed; } catch (WebException ex) { // Something went wrong in the api await DialogHelper.ShowMessageDialogAsync(ex.Message); } catch (Exception ex) { // Failed await DialogHelper.ShowGenericErrorDialogAsync(ex); } IsBusy = false; }