Exemplo n.º 1
0
        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());
            
        }
Exemplo n.º 2
0
 public void MainPage_Loaded(object sender, RoutedEventArgs e)
 {
     webServiceHandler = new WebServiceHandler();
     applicationUser = WhistleUser.GetInstance();
 }
Exemplo n.º 3
0
 public static WhistleUser GetInstance()
 {
     if (whistleUser == null)
         whistleUser = new WhistleUser();
     return whistleUser;
 }
Exemplo n.º 4
0
        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();
                }
                
                
            }
        }