Ejemplo n.º 1
0
        public static void RZLogIn(ref List <RZAccount> RZAccountsList)
        {
            Console.SetBufferSize(75, 20);
            Console.SetWindowSize(75, 20);

            int u_ind = 0;

            Console.SetCursorPosition(1, 6);
            Console.WriteLine("Press Up or Down Key");
            Console.SetCursorPosition(1, 7);
            Console.Write($"User Name: {RZAccountsList[u_ind].RZLogin}");
            do
            {
                Console.SetCursorPosition(12, 7);
                Console.BackgroundColor = ConsoleColor.DarkBlue;
                Console.ForegroundColor = ConsoleColor.White;
                int login_len = 0;
                foreach (var item in RZAccountsList)
                {
                    if (login_len < item.RZLogin.Length)
                    {
                        login_len = item.RZLogin.Length;
                    }
                }
                for (int i = 0; i <= login_len; i++)
                {
                    Console.Write(" ");
                }
                Console.SetCursorPosition(12, 7);
                Console.WriteLine(RZAccountsList[u_ind].RZLogin);
                Console.ResetColor();
                Console.SetCursorPosition(12, 7);
                var cki = Console.ReadKey();
                //Console.WriteLine(cki.Key);

                if (cki.Key == ConsoleKey.Escape)
                {
                    RZMain.RZMainMenyu(ref RZAccountsList);
                }
                if (cki.Key == ConsoleKey.DownArrow)
                {
                    u_ind += 1;
                    if (u_ind >= RZAccountsList.Count)
                    {
                        u_ind = RZAccountsList.Count - 1;
                    }
                }
                if (cki.Key == ConsoleKey.UpArrow)
                {
                    u_ind -= 1;
                    if (u_ind <= 0)
                    {
                        u_ind = 0;
                    }
                }
                if (cki.Key == ConsoleKey.Enter)
                {
                    string temp_password;
                    Console.SetCursorPosition(1, 8);
                    Console.WriteLine("User Pass: "******"                    ");
                    Console.SetCursorPosition(12, 8);
                    Console.BackgroundColor = ConsoleColor.DarkBlue;
                    Console.ForegroundColor = ConsoleColor.White;
                    for (int i = 0; i <= login_len; i++)
                    {
                        Console.Write(" ");
                    }
                    Console.SetCursorPosition(12, 8);
                    temp_password = Console.ReadLine();
                    Console.ResetColor();

                    if (temp_password == RZAccountsList[u_ind].RZPassword)
                    {
                        Console.SetCursorPosition(20, 0);
                        for (int i = 0; i < password_len; i++)
                        {
                            Console.Write(" ");
                        }
                        Console.SetCursorPosition(1, 9);
                        Console.WriteLine("                      ");
                        Console.SetCursorPosition(1, 9);
                        Console.WriteLine("Correct Password");
                        Console.SetCursorPosition(50, 0);
                        RZMain.ThisUser = RZAccountsList[u_ind].RZLogin;
                        Console.WriteLine($"Welcome, { RZMain.ThisUser }");

                        RZMain.RZMainMenyu(ref RZAccountsList);
                    }
                    else
                    {
                        Console.SetCursorPosition(1, 9);
                        Console.WriteLine("Don't correct password");
                        Console.SetCursorPosition(1, 6);
                        Console.WriteLine("Press Up or Down Key");
                        Console.SetCursorPosition(1, 8);
                        Console.WriteLine("                                  ");
                        Console.SetCursorPosition(12, 7);
                    }
                    //Console.WriteLine(oldInfo[u_ind].rz_password);
                }
                if (cki.Key == ConsoleKey.F1)
                {
                    Console.SetCursorPosition(20, 0);
                    Console.WriteLine(RZAccountsList[u_ind].RZPassword);
                }
            } while (true);
        }
Ejemplo n.º 2
0
        private static void RZParameters(ref List <RZAccount> RZAccountsList)
        {
            Console.SetWindowSize(20, 11);
            Console.SetBufferSize(20, 11);

            int m_ind   = 0;
            int m_count = 2;
            var m_list  = new string[m_count];

            m_list[0] = "  Reset Database  ";
            m_list[1] = "      Back        ";

            ConsoleKeyInfo cki;

            do
            {
                Console.Clear();
                for (short i = 0; i < m_list.Length; i++)
                {
                    if (m_ind == i)
                    {
                        SetColorBlue();
                        Console.WriteLine(m_list[i]);
                        Console.ResetColor();
                    }
                    else
                    {
                        Console.WriteLine(m_list[i]);
                    }
                }
                cki = Console.ReadKey();
                //Console.WriteLine(cki.Key);
                if (cki.Key == ConsoleKey.Escape)
                {
                    break;
                }
                if (cki.Key == ConsoleKey.DownArrow)
                {
                    m_ind += 1;
                    if (m_ind >= m_count)
                    {
                        m_ind = m_count - 1;
                    }
                }
                if (cki.Key == ConsoleKey.UpArrow)
                {
                    m_ind -= 1;
                    if (m_ind <= 0)
                    {
                        m_ind = 0;
                    }
                }
                if (cki.Key == ConsoleKey.Enter)
                {
                    switch (m_ind)
                    {
                    case 0:
                        RZDatabaseRestore(ref RZAccountsList);
                        Console.ReadKey();
                        RZMain.Main(new string[] { });
                        break;

                    case 1:
                        RZMainMenyu(ref RZAccountsList);
                        break;
                    }
                }
            } while (true);
        }