コード例 #1
0
        static void Main(string[] args)
        {
            while (true)
            {
                bool again = true;
                while (again)
                {
                    again = false;

                    Console.WriteLine("Please enter your username: "******"Please enter your password: "******"Now logging in as {CurrentUser}.");
                    }
                    catch (KeyNotFoundException)
                    {
                        again = true;
                        Console.WriteLine("Incorrect username or password. Please try again.");
                    }
                }
                FakeLoading();

                while (CurrentUser != null)
                {
                    Console.Clear();

                    Console.WriteLine($"Welcome {CurrentUser.name}");

                    Console.WriteLine("These are your options: ");

                    try
                    {
                        CurrentUser.PrintActions();
                    } catch (GoBackException)
                    {
                        Console.WriteLine("Welcome back! TODO");
                    }

                    if (CurrentUser != null)
                    {
                        Console.ReadLine();
                    }
                    else
                    {
                        Console.Clear();
                    }
                }
            }
        }
コード例 #2
0
        string name, password;  // The name and password strings are what will be used to find the corresponding user in the dictionary.

        public Login(CampusMember member)
        {
            this.name     = member.name;
            this.password = member.password;
        }