private async void loadUser() { var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; var email = (string)localSettings.Values["Email"]; PersonService service = new PersonService(); try { User = await service.getDetailsPersonAsync(email); }catch (NoNetworkException e) { ShowToast(e.ToString()); } }
private async void Search_Click() { if (CanExecute()) { PersonService service = new PersonService(); try { Input = FirstLetterToUpperCase(Input); if (EmailChecked) { var person = await service.getDetailsPersonAsync(Input); ListPerson[0] = person; } else { if (NameChecked) { ListPerson = await service.searchPersonByNameAsync(Input); } else { if (CompanyChecked) { ListPerson = await service.searchPersonByCompanyAsync(Input); } else { var loader = new Windows.ApplicationModel.Resources.ResourceLoader(); string str = loader.GetString("searchEmptyString"); throw new SearchFieldEmpty(str); } } } if (ListPerson.Length != 0) { _navigationService.NavigateTo("SearchListPage", ListPerson); } else { ShowToast("emptySearch"); } }catch (NoNetworkException e) { ShowToast(e.ToString()); } catch (SearchFieldEmpty searchFieldEmpty) { ShowToast(searchFieldEmpty.toString()); } catch (Exception e) { ShowToast("search_not_found"); } } }