Exemplo n.º 1
0
        public void DialogsDraw(string Dialog)
        {
            BoxDrawer     DialogWindow = new BoxDrawer();
            menuUtilities Menu         = new menuUtilities();
            int           length       = Dialog.Length;
            int           hwidth       = Console.WindowWidth / 2;
            int           hheight      = Console.WindowHeight / 2;
            int           dislocation  = (length + 4) / 2 + 3;

            Menu.entryHilighter(Vars.numberOfEntries, Vars.menuEntries, Vars.numberOfEntries);
            Console.SetCursorPosition(hwidth - length / 2, hheight - 1);
            Console.Write(Dialog);
            Console.SetCursorPosition(hwidth - 1, hheight + 1);
            Console.BackgroundColor = ConsoleColor.White;
            Console.ForegroundColor = ConsoleColor.Black;
            Console.Write("OK");
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.White;
            DialogWindow.Draw(length + 4, 5);
        }
        public void Xplore()
        {
            string startdir = Environment.CurrentDirectory;
            string window1  = startdir;
            string window2  = startdir;

            string[]      dir1;
            string[]      dir2;
            int           offx     = (Console.WindowWidth - 1) / 2 + 2;
            int           index    = 0;
            PanelsDrawer  Panel    = new PanelsDrawer();
            menuUtilities FileList = new menuUtilities();

            Panel.DrawTwoPanels();

            while (true)
            {
                dir1 = Directory.GetDirectories(window1);
                dir2 = Directory.GetDirectories(window2);
                FileList.entryHilighter(index, dir1, dir1.Length, 1, true);
                Panel.DrawTwoPanels();
                Console.ReadKey(true);
            }
        }
        public void MainCycleStart(int defaultChecked, string [] menuEntries, int entries)
        {
            menuUtilities Menu     = new menuUtilities();
            BoxDrawer     Box      = new BoxDrawer();
            DialogsEngine Dialog   = new DialogsEngine();
            PanelsDrawer  Panel    = new PanelsDrawer();
            FileExplorer  Explorer = new FileExplorer();

            Menu.entryHilighter(defaultChecked, menuEntries, entries);
            while (true)
            {
                ConsoleKeyInfo key = Console.ReadKey(true);

                if (key.Key == ConsoleKey.UpArrow)
                {
                    if (defaultChecked == 0)
                    {
                        defaultChecked = entries - 1;
                    }
                    else
                    {
                        defaultChecked -= 1;
                    }
                    Menu.entryHilighter(defaultChecked, menuEntries, entries);
                }
                if (key.Key == ConsoleKey.DownArrow)
                {
                    if (defaultChecked == entries - 1)
                    {
                        defaultChecked = 0;
                    }
                    else
                    {
                        defaultChecked += 1;
                    }
                    Menu.entryHilighter(defaultChecked, menuEntries, entries);
                }
                if (defaultChecked == entries - 1 && key.Key == ConsoleKey.Enter)
                {
                    break;
                }

                if (defaultChecked == 0 && key.Key == ConsoleKey.Enter)
                {
                    try{
                        Console.WriteLine("Please, set width of the box: ");
                        int width = Convert.ToInt32(Console.ReadLine());
                        Console.WriteLine("Please, set height of the box: ");
                        int height = Convert.ToInt32(Console.ReadLine());
                        Box.Draw(width, height);
                    }
                    catch (Exception e)
                    {
                        Menu.entryHilighter(0, menuEntries, entries);
                    }
                }
                if (defaultChecked == 1 && key.Key == ConsoleKey.Enter)
                {
                    Console.WriteLine("Please, write a string to display in dialog:");
                    string dialog = Console.ReadLine();
                    Dialog.DialogsDraw(dialog);
                }
                if (defaultChecked == 2 && key.Key == ConsoleKey.Enter)
                {
                    Console.Clear();
                    Panel.DrawTwoPanels();
                }
                if (defaultChecked == 3 && key.Key == ConsoleKey.Enter)
                {
                    Console.Clear();
                    Explorer.Xplore();
                }
            }
        }