コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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));
        }
コード例 #4
0
 public RegisterMedicalPage()
 {
     this.InitializeComponent();
     this.FixPageSize();
     PagesUtilities.AddBackButtonHandler((object sender, Windows.UI.Core.BackRequestedEventArgs e) =>
     {
         BackToRegister(null, null);
     });
 }
コード例 #5
0
        private void ContinueNegativeEffectsRegister(object sender, TappedRoutedEventArgs e)
        {
            PagesUtilities.GetAllCheckBoxesTags(RegisterPositiveEffectsGrid,
                                                out List <int> intList);

            GlobalContext.RegisterContext.IntPositivePreferences = intList;

            Frame.Navigate(typeof(RegisterNegativeEffectsPage));
        }
コード例 #6
0
 public DashboardPage()
 {
     this.InitializeComponent();
     this.FixPageSize();
     PagesUtilities.AddBackButtonHandler((object sender, Windows.UI.Core.BackRequestedEventArgs e) =>
     {
         e.Handled = true;
         LogoutHandler(null, null);
     });
 }
コード例 #7
0
        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;
            }
        }
コード例 #8
0
ファイル: LoginPage.xaml.cs プロジェクト: tauprojects/ehealth
        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;
            }
        }
コード例 #9
0
 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}]");
     }
 }
コード例 #10
0
        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");
                }
            }
        }
コード例 #11
0
        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");
                }
            }
        }
コード例 #12
0
 public void OnPageLoaded(object sender, RoutedEventArgs e)
 {
     PagesUtilities.DontFocusOnAnythingOnLoaded(sender, e);
 }
コード例 #13
0
ファイル: LoginPage.xaml.cs プロジェクト: tauprojects/ehealth
 public LoginPage()
 {
     this.InitializeComponent();
     this.FixPageSize();
     PagesUtilities.AddBackButtonHandler();
 }