private void BackToPositiveEffectsRegister(object sender, TappedRoutedEventArgs e) { // Save changes to checkboxes before navigating back PagesUtilities.GetAllCheckBoxesTags(RegisterNegativeEffectsGrid, out List <int> intList); GlobalContext.RegisterContext.IntNegativePreferences = intList; Frame.Navigate(typeof(RegisterPositiveEffectsPage)); }
private void ContinuePositiveEffectsRegister(object sender, TappedRoutedEventArgs e) { // Save changes to checkboxes and continue PagesUtilities.GetAllCheckBoxesTags(RegisterMedicalGrid, out List <int> intList); GlobalContext.RegisterContext.IntListMedicalNeeds = intList; Frame.Navigate(typeof(RegisterPositiveEffectsPage), GlobalContext.RegisterContext); }
private void BackToRegister(object sender, TappedRoutedEventArgs e) { // Save changes to checkboxes before navigating back PagesUtilities.GetAllCheckBoxesTags(RegisterMedicalGrid, out List <int> intList); GlobalContext.RegisterContext.IntListMedicalNeeds = intList; Frame.Navigate(typeof(RegisterPage)); }
public RegisterMedicalPage() { this.InitializeComponent(); this.FixPageSize(); PagesUtilities.AddBackButtonHandler((object sender, Windows.UI.Core.BackRequestedEventArgs e) => { BackToRegister(null, null); }); }
private void ContinueNegativeEffectsRegister(object sender, TappedRoutedEventArgs e) { PagesUtilities.GetAllCheckBoxesTags(RegisterPositiveEffectsGrid, out List <int> intList); GlobalContext.RegisterContext.IntPositivePreferences = intList; Frame.Navigate(typeof(RegisterNegativeEffectsPage)); }
public DashboardPage() { this.InitializeComponent(); this.FixPageSize(); PagesUtilities.AddBackButtonHandler((object sender, Windows.UI.Core.BackRequestedEventArgs e) => { e.Handled = true; LogoutHandler(null, null); }); }
private async void Register(object sender, RoutedEventArgs e) { HttpResponseMessage res = null; try { // Build register request progressRing.IsActive = true; // Get negative checkboxes PagesUtilities.GetAllCheckBoxesTags(RegisterNegativeEffectsGrid, out List <int> intList); GlobalContext.RegisterContext.IntNegativePreferences = intList; // Send request with register information res = await HttpManager.Manager.Post(Constants.MakeUrl("register"), GlobalContext.RegisterContext); if (res != null) { // Request succeeded var content = res.GetContent(); switch (res.StatusCode) { // Register succeeded case HttpStatusCode.Created: case HttpStatusCode.OK: Status.Text = "Register Successful!"; PagesUtilities.SleepSeconds(1); Frame.Navigate(typeof(DashboardPage), res); break; // Register failed case HttpStatusCode.BadRequest: Status.Text = "Register failed!\n" + content["message"]; break; default: Status.Text = "Error!\n" + content["message"]; break; } } else { Status.Text = "Register failed!\nPost operation failed"; } } catch (Exception exc) { AppDebug.Exception(exc, "Register"); } finally { progressRing.IsActive = false; } }
private async void PostLogin(object sender, RoutedEventArgs e) { AppDebug.Line("PostLogin"); HttpResponseMessage res = null; progressRing.IsActive = true; try { // Create login request var req = new LoginRequest(Username.Text, Password.Password); res = await Task.Run(async() => await HttpManager.Manager.Post(Constants.MakeUrl("login"), req)); if (res != null) { // Request succeeded var content = res.GetContent(); switch (res.StatusCode) { // Login successfull case HttpStatusCode.OK: AppDebug.Line("Login success!"); PagesUtilities.SleepSeconds(1); progressRing.IsActive = false; Frame.Navigate(typeof(DashboardPage), res); break; // Login failed case HttpStatusCode.BadRequest: Status.Text = "Login failed!\n" + content["message"]; break; default: Status.Text = "Error!\n" + content["message"]; break; } } else { Status.Text = "Login failed!\nPost operation failed"; } } catch (Exception exc) { Status.Text = "Exception during login"; AppDebug.Exception(exc, "PostLogin"); } finally { progressRing.IsActive = false; } }
public void OnPageLoaded(object sender, RoutedEventArgs e) { PagesUtilities.DontFocusOnAnythingOnLoaded(sender, e); if (GlobalContext.CurrentUser == null) { UsageHistoryButton.IsEnabled = false; MyProfileButton.IsEnabled = false; Welcome.Text = "Debug Session, no user"; } else { // Login successfull Welcome.Text = $"Welcome, {GlobalContext.CurrentUser.Data.Username}!"; AppDebug.Line($"Wrote welocme text: [{Welcome.Text}]"); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); var req = GlobalContext.RegisterContext; if (req != null) { try { // If checkboxes were chosen before, update them again PagesUtilities.SetAllCheckBoxesTags(RegisterMedicalGrid, req.IntListMedicalNeeds); } catch (Exception exc) { AppDebug.Exception(exc, "RegisterMedicalPage.OnNavigatedTo"); } } }
public void OnPageLoaded(object sender, RoutedEventArgs e) { PagesUtilities.DontFocusOnAnythingOnLoaded(sender, e); var req = GlobalContext.RegisterContext; if (req != null) { try { // Load previously entered details, or empty if none exist Username.Text = req.Username ?? ""; Password.Password = ""; Country.Text = req.Country ?? ""; City.Text = req.City ?? ""; Email.Text = req.Email ?? ""; if (req.Gender != null) { if (req.Gender == "Male") { Gender.SelectedIndex = 1; } else if (req.Gender == "Female") { Gender.SelectedIndex = 2; } else { Gender.SelectedIndex = 0; } } } catch (Exception exc) { AppDebug.Exception(exc, "RegisterPage.OnPageLoaded"); } } }
public void OnPageLoaded(object sender, RoutedEventArgs e) { PagesUtilities.DontFocusOnAnythingOnLoaded(sender, e); }
public LoginPage() { this.InitializeComponent(); this.FixPageSize(); PagesUtilities.AddBackButtonHandler(); }