Example #1
0
        private void Login(string naam, string pass) // inlogknop
        {
            api  api       = new api();
            User loginUser = api.GetUser(naam, pass);

            if (loginUser.Name != null)
            {
                GlobalSettings.Id    = loginUser.Id;
                GlobalSettings.Naam  = loginUser.Name;
                GlobalSettings.Email = loginUser.Email;
                GlobalSettings.Pass  = loginUser.Password;

                char[] seperator = ".".ToCharArray();

                GlobalSettings.AllergieList = loginUser.allergies.Split(seperator).ToList();
                MainWindow.AppWindow.switchPage(2);
                MainWindow.AppWindow.EnableButtons();

                MainWindow.AppWindow.GetShoppinglist();
            }
            else
            {
                MessageBox.Show("Kan gebruiker niet vinden", "Error!", MessageBoxButton.OK);
                TxtUser.Clear();
                TxtPass.Clear();
            }
        }