public MainCategories() { this.InitializeComponent(); this.Loaded += MainCategories_Loaded; AppData.GetGeolocation(); webServiceHandler = new WebServiceHandler(); if (ApplicationData.Current.LocalSettings.Values.ContainsKey("whistleUser")) appUser = JsonConvert.DeserializeObject<WhistleUser>(ApplicationData.Current.LocalSettings.Values["whistleUser"].ToString()); }
public void MainPage_Loaded(object sender, RoutedEventArgs e) { webServiceHandler = new WebServiceHandler(); applicationUser = WhistleUser.GetInstance(); }
public static WhistleUser GetInstance() { if (whistleUser == null) whistleUser = new WhistleUser(); return whistleUser; }
private async void doneButton_Tapped(object sender, TappedRoutedEventArgs e) { if (AppData.CheckNetworkConnection()) { this.ViewModel.ShowOverlay(); //this.LoadAllCategoriesData(); HttpClient httpClient = new HttpClient(); string request = @"{""verify"": """ + textBoxCode.Text + "\"}"; var content = new StringContent(request, System.Text.Encoding.UTF8, "application/json"); HttpResponseMessage responseData = await httpClient.PostAsync(AppData.BaseAddress + "api/user/verifySignup", content); if (responseData.StatusCode == System.Net.HttpStatusCode.OK) { string whistleUser = await responseData.Content.ReadAsStringAsync(); this.applicationUser = JsonConvert.DeserializeObject<WhistleUser>(whistleUser); if (ApplicationData.Current.LocalSettings.Values.ContainsKey("whistleUser")) ApplicationData.Current.LocalSettings.Values["whistleUser"] = whistleUser; else ApplicationData.Current.LocalSettings.Values.Add("whistleUser", whistleUser); this.ViewModel.HideOverlay(); this.LoadAllCategoriesData(); } else { string responseDataString = await responseData.Content.ReadAsStringAsync(); MessageDialog msgBox = new MessageDialog(responseDataString); this.ViewModel.HideOverlay(); await msgBox.ShowAsync(); } } }