示例#1
0
        public static void DynamicChoosing(bool firstwrite, List <string> menu, int menuCounter)
        {
            Typeclass Writer           = new Typeclass();
            int       lineCounter      = 6;
            int       stringCounter    = menu.Count;
            int       counter          = 0;
            bool      continueAccepted = false;


            if (menuCounter <= stringCounter)
            {
                //menuCounter--;
                continueAccepted = true;
            }

            ClearCurrentConsoleLine(menu);
            if (continueAccepted && !firstwrite)
            {
                foreach (var item in menu)
                {
                    counter++;
                    Console.SetCursorPosition(1, lineCounter);
                    if (counter.Equals(menuCounter))
                    {
                        Console.BackgroundColor = ConsoleColor.DarkRed;
                        Console.ForegroundColor = ConsoleColor.Black;
                        Console.WriteLine(item);
                        Console.ResetColor();
                    }
                    else
                    {
                        Console.WriteLine(item);
                    }
                    lineCounter++;
                }
            }
            else if (continueAccepted && firstwrite)
            {
                foreach (var item in menu)
                {
                    counter++;
                    Console.SetCursorPosition(1, lineCounter);
                    if (counter.Equals(menuCounter))
                    {
                        Console.BackgroundColor = ConsoleColor.DarkRed;
                        Console.ForegroundColor = ConsoleColor.Black;
                        Writer.TypeWriter(item);
                        Console.ResetColor();
                    }
                    else
                    {
                        Writer.TypeWriter(item);
                    }
                    lineCounter++;
                }
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.WindowHeight  = 25;
            Console.WindowWidth   = 95;
            Console.CursorVisible = false;
            bool   titleMenuBool = false;
            bool   firstWrite    = true;
            int    menuCounter   = 1;
            string currentMenu   = "Main";

            Typeclass Writer = new Typeclass();

            Console.SetCursorPosition(Console.WindowWidth / 2 - 10, 1);
            Writer.TypeWriter("Sydvest-Bo Sommerhuse");
            Console.SetCursorPosition(70, 21);
            Console.ForegroundColor = ConsoleColor.DarkGray;
            Console.WriteLine("F1 Opret Sommerhus Ejer");
            Console.SetCursorPosition(70, 22);
            Console.WriteLine("F2 Opret Sommerhus");
            Console.SetCursorPosition(70, 23);
            Console.WriteLine("F3 Opret Reservation.");
            Console.ResetColor();

            if (SQL.SQLConnectionOK())
            {
                //Console.WriteLine("Connection virker :D");
            }
            else
            {
                //Console.WriteLine("Something wrong :sad:");
            }


            List <string> mainScreen = new List <string>()
            {
                "Sommerhus ejere:",
                "Sommerhuse:",
                "Reservationer:",
                "Udlejningskonsulenter:"
            };

            DynamicChoosing(firstWrite, mainScreen, menuCounter);
            firstWrite = false;
            MenuOptions(mainScreen, currentMenu);

            Console.ReadLine();
        }