public PetHomeMenu(UserPageMenu last) : base("Animal Home")
 {
     this.AddItem(new MenuItem("Do an Activity", null));
     this.AddItem(new MenuItem("Eat", null));
     this.AddItem(new MenuItem("Clean", null));
     this.AddItem(new MenuItem("View History", null));
     this.AddItem(new MenuItem("Back to User Page", last));
     this.AddItem(new MenuItem("Sign out", MainApp.loginScreen));
 }
Example #2
0
 public CreateNewAnimalScreen(UserPageMenu last) : base("Create New Animal")
 {
     this.last = last;
 }
 public LoginScreen() : base("Login Screen")
 {
     next = null;
 }
        public override void Show()
        {
            base.Show();
            if (MainApp.currentPlayer == null)
            {
                Console.WriteLine("Please enter your username:"******"Please enter your password");
                string           pass = Console.ReadLine();
                Task <PlayerDTO> p    = MainApp.api.LoginAsync(uName, pass);
                p.Wait();
                MainApp.currentPlayer = p.Result;
                //MainApp.currentPlayer = MainApp.db.Login("Mitzi123", "HaHato0l1234123"); //For testing
                if (MainApp.currentPlayer == null)
                {
                    //new ErrorScreen("Incorrect Username or Pass Error", this).Show();
                    Console.WriteLine("Incorrect username or password\nPress any key to try again.");
                    Console.ReadKey();
                    this.Show();
                }
                else
                {
                    next = new UserPageMenu();
                    Console.WriteLine("Login Succesfull!\nPress any key to continue...");
                    Console.ReadKey();
                    next.Show();
                }
            }
            else
            {
                Console.WriteLine("Would like to sign out and re-Login? Y/N");

                bool validChoice = false;
                while (!validChoice)
                {
                    char choice = Console.ReadKey().KeyChar;
                    switch (choice)
                    {
                    case 'y':
                    case 'Y':
                        Task <bool> t = MainApp.api.LogOutAsync();
                        t.Wait();
                        if (t.Result)
                        {
                            MainApp.currentPlayer = null;
                        }
                        else
                        {
                            Console.WriteLine("There was a Problem logging out");
                        }
                        validChoice = true;
                        this.Show();
                        break;

                    case 'n':
                    case 'N':
                        validChoice = true;
                        next        = new UserPageMenu();
                        next.Show();

                        break;

                    default:
                        Console.WriteLine("\nInvalid input! Enter 'Y' for yes, or 'N' for No.");

                        break;
                    }
                }
            }
        }
Example #5
0
 public ChangePasswordScreen(UserPageMenu last) : base("Change Password")
 {
     this.last = last;
 }