Ejemplo n.º 1
0
        public void LoginScreen()
        {
            Console.Title = "(Z.E.T.A.) Zero sa Exam Terminal Application";
            string username, password;

            Console.BackgroundColor = Color.SeaGreen;
            Console.Clear();
            Console.CursorTop = 4;
            Message.CreateBox("", 13, 26, "");
            Console.CursorTop = 2;
            Message.TitleBox("L O G I N", 5, 20, ConsoleColor.Red, ConsoleColor.White);



            Message.BoxColor     = Color.Blue;
            Message.BoxtextColor = Color.White;



            Message.CreateBox("  U S E R N A M E  ", 3, 30, "____");
            //syn.Speak("Enter your username");
            Console.SetCursorPosition((Console.WindowWidth / 2) - 3, Console.CursorTop - 1);
            username = Console.ReadLine();

            Console.WriteLine();

            Message.BoxColor     = Color.White;
            Message.BoxtextColor = Color.Black;
            Message.CreateBox("  P A S S W O R D  ", 3, 30, "____");
            //syn.Speak("Enter your password");
            Console.SetCursorPosition((Console.WindowWidth / 2) - 3, Console.CursorTop - 1);
            password = Console.ReadLine();



            if (db.isRegistered(username, password))
            {
                new Thread(() => Console.Beep(320, 250)).Start();
                Console.BackgroundColor = Color.SteelBlue;
                Console.Clear();
                USERNAME = username;
                //syn.Speak("Success, Please wait");

                SystemMenu();
            }
            else
            {
                //syn.Speak("Error, Invalid username or password");
                counter++;
                if (counter < 3)
                {
                    Console.CursorTop = 7;
                    Message.TitleBox("I N V A L I D  U S E R  O R  P A S S  T R Y  A G A I N ", 5, 60, ConsoleColor.Red, ConsoleColor.White);

                    Thread.Sleep(1000);

                    LoginScreen();
                }
                else
                {
                    for (int i = 3; i >= 0; i--)
                    {
                        Console.BackgroundColor = Color.Red;
                        Console.Clear();
                        Console.CursorTop = 7;
                        Message.TitleBox("S Y S T E M    B L O C K E D ", 6, 60, ConsoleColor.Red, ConsoleColor.White);
                        Console.CursorTop  = 11;
                        Console.CursorLeft = (Console.WindowWidth / 2) - 10;
                        Console.WriteLine("E X I T T I N G  I N  {0}", i);
                        Thread.Sleep(1000);
                    }
                    System.Environment.Exit(0);
                }
            }
        }
Ejemplo n.º 2
0
        public void SystemMenu()
        {
            Console.Title           = "(Z.E.T.A.) Zero sa Exam Terminal Application";
            Console.BackgroundColor = Color.SeaGreen;
            Console.Clear();
            Console.WindowHeight = Console.LargestWindowHeight;
            Console.WindowWidth  = Console.LargestWindowWidth;
            ConsoleKey select, ok;

            Console.CursorTop = 4;
            Message.BoxColor  = Color.Maroon;
            Message.CreateBox("", 30, 34, "");
            Message.BoxColor  = Color.White;
            Console.CursorTop = 2;
            Console.WriteLine();
            Message.menuBox(3, 30, " M E N U ", ConsoleColor.Red, ConsoleColor.White, 1);
            Message.menuBox(3, 30, " A. U S E R  A C C O U N T ", ConsoleColor.Blue, ConsoleColor.White, 1, -10);
            Thread.Sleep(250);
            Message.menuBox(3, 30, " B. B A S I C ", ConsoleColor.White, ConsoleColor.Blue, 1, 10);
            Thread.Sleep(250);
            Message.menuBox(3, 30, " C. I N T E R M E D I A T E ", ConsoleColor.Blue, ConsoleColor.White, 1, -10);
            Thread.Sleep(250);
            Message.menuBox(3, 30, " D. E N T E R T A I N M E N T ", ConsoleColor.White, ConsoleColor.Blue, 1, 10);
            Thread.Sleep(250);
            Message.menuBox(3, 30, " E. C R E D I T S ", ConsoleColor.Blue, ConsoleColor.White, 1, -10);
            Thread.Sleep(250);
            Message.menuBox(3, 30, " F. E X I T ", ConsoleColor.White, ConsoleColor.Blue, 1, 10);
            Message.menuBox(1, 10, " E N T E R  K E Y  O F  Y O U R  C H O I C E ", ConsoleColor.Blue, ConsoleColor.White);
            Console.CursorLeft = (Console.WindowWidth / 2);

            select = Console.ReadKey().Key;

            if (select.Equals(ConsoleKey.A))
            {
                new Thread(() => Console.Beep(320, 250)).Start();
                userAccount();
            }
            else if (select.Equals(ConsoleKey.B))
            {
                new Thread(() => Console.Beep(320, 250)).Start();
                Basic();
            }
            else if (select.Equals(ConsoleKey.C))
            {
                new Thread(() => Console.Beep(320, 250)).Start();
                Intermidiate();
            }
            else if (select.Equals(ConsoleKey.D))
            {
                new Thread(() => Console.Beep(320, 250)).Start();
                Entertainement();
            }
            else if (select.Equals(ConsoleKey.E))
            {
                new Thread(() => Console.Beep(320, 250)).Start();
                Credits();
            }
            else if (select.Equals(ConsoleKey.F))
            {
                new Thread(() => Console.Beep(320, 250)).Start();
                exit();
            }

            else
            {
                Message.Show("Invalid Selection", "[O]K");
                ok = Console.ReadKey().Key;
                SystemMenu();
            }

            Message.Show("Do you want to exit or go to Menu ?", "[E]xit : [Any key] Menu");

            select = Console.ReadKey().Key;

            if (select.Equals(ConsoleKey.E))
            {
                System.Environment.Exit(0);
            }
            else
            {
                SystemMenu();
            }
        }