Esempio n. 1
0
            public static int DirActivity01(Stream Input)
            {
                Graphics.ConsoleWriter ConsoleOut = new Graphics.ConsoleWriter("Program");

                ConsoleKeyInfo input;

                Graphics.Menu MainMenu = new Graphics.Menu();

                ConsoleOut.MakeMenu(MainMenu);


                string Text = "";

                Text = "Add";
                MainMenu.AddItem(new Graphics.UIObject(Text, ConsoleOut.XOffset(Text.Length), 7, Applications.applications.Add));
                Text = "Average";
                MainMenu.AddItem(new Graphics.UIObject(Text, ConsoleOut.XOffset(Text.Length), 8, Applications.applications.Average));
                Text = "Convert Temperature";
                MainMenu.AddItem(new Graphics.UIObject(Text, ConsoleOut.XOffset(Text.Length), 9, Applications.applications.ConvertTemp));
                Text = "Convert Height and Weight";
                MainMenu.AddItem(new Graphics.UIObject(Text, ConsoleOut.XOffset(Text.Length), 10, Applications.applications.HeightAndWeight));
                Text = "Calculate Pay";
                MainMenu.AddItem(new Graphics.UIObject(Text, ConsoleOut.XOffset(Text.Length), 11, Applications.applications.WorkerPay));
                Text = "Queue";
                MainMenu.AddItem(new Graphics.UIObject(Text, ConsoleOut.XOffset(Text.Length), 12, Applications.applications.Queue));
                Text = "Go Back";
                MainMenu.AddItem(new Graphics.UIObject(Text, ConsoleOut.XOffset(Text.Length), 13, null));

                bool quit = false;

                while (!quit)
                {
                    ConsoleOut.Draw();

                    input = Console.ReadKey(false);
                    switch (input.Key)
                    {
                    case ConsoleKey.UpArrow: MainMenu.ChangeSelected(-1);
                        break;

                    case ConsoleKey.DownArrow: MainMenu.ChangeSelected(1);
                        break;

                    case ConsoleKey.Enter: if (MainMenu.GetSelected().Content == "Go Back")
                        {
                            quit = true;
                        }
                        else
                        {
                            MainMenu.Activate(null);
                        }
                        break;
                    }
                }

                return(0);
            }
Esempio n. 2
0
            public static int DirPersonal(Stream Input)
            {
                Graphics.ConsoleWriter ConsoleOut = new Graphics.ConsoleWriter("Program");

                ConsoleKeyInfo input;

                Graphics.Menu MainMenu = new Graphics.Menu();

                ConsoleOut.MakeMenu(MainMenu);


                string Text = "";

                Text = "RogueLike";
                MainMenu.AddItem(new Graphics.UIObject(Text, ConsoleOut.XOffset(Text.Length), 7, RogueLike));
                Text = "Go Back";
                MainMenu.AddItem(new Graphics.UIObject(Text, ConsoleOut.XOffset(Text.Length), 8, null));

                bool quit = false;

                while (!quit)
                {
                    ConsoleOut.Draw();

                    input = Console.ReadKey(false);
                    switch (input.Key)
                    {
                    case ConsoleKey.UpArrow:
                        MainMenu.ChangeSelected(-1);
                        break;

                    case ConsoleKey.DownArrow:
                        MainMenu.ChangeSelected(1);
                        break;

                    case ConsoleKey.Enter:
                        if (MainMenu.GetSelected().Content == "Go Back")
                        {
                            quit = true;
                        }
                        else
                        {
                            MainMenu.Activate(null);
                        }
                        break;
                    }
                }

                return(0);
            }
Esempio n. 3
0
            public static int HeightAndWeight(Stream Input)
            {
                Graphics.ConsoleWriter ConsoleOut = new Graphics.ConsoleWriter("Convert Height and Weight");

                string TextInput = "";

                Graphics.Menu InputMenu = new Graphics.Menu();

                double Height = 0;
                double Weight = 0;
                double Temp   = 0;

                ConsoleOut.MakeMenu(InputMenu);

                Graphics.UIObject HeightInput = new Graphics.UIObject("Input Height", ConsoleOut.XOffset("Input Height".Length), 9, null);
                Graphics.UIObject WeightInput = new Graphics.UIObject("Input Weight", ConsoleOut.XOffset("Input Weight".Length), 10, null);
                Graphics.UIObject QuitButton  = new Graphics.UIObject("Go Back", ConsoleOut.XOffset("Go Back".Length), 11, null);

                InputMenu.AddItem(HeightInput);
                InputMenu.AddItem(WeightInput);
                InputMenu.AddItem(QuitButton);

                bool Quit = false;

                ConsoleKeyInfo InputKey;

                do
                {
                    ConsoleOut.WriteLine("Weight: " + (Weight * 6.364).ToString() + "Kg Height: " + (Height * 2.54).ToString() + "cm ", 7);

                    ConsoleOut.Draw();
                    InputKey = Console.ReadKey();
                    switch (InputKey.Key)
                    {
                    case ConsoleKey.UpArrow:
                        InputMenu.ChangeSelected(-1);
                        break;

                    case ConsoleKey.DownArrow:
                        InputMenu.ChangeSelected(1);
                        break;

                    case ConsoleKey.Enter:
                    {
                        if (InputMenu.GetSelected().Content == "Go Back")
                        {
                            Quit = true;
                        }
                        else if (InputMenu.GetSelected().Content == "Input Height")
                        {
                            TextInput = Console.ReadLine();
                            double.TryParse(TextInput, out Temp);
                            Height = Temp;
                        }
                        else
                        {
                            TextInput = Console.ReadLine();
                            double.TryParse(TextInput, out Temp);
                            Weight = Temp;
                        }
                    }
                    break;
                    }
                } while (!Quit);

                return(0);
            }
Esempio n. 4
0
            public static int WorkerPay(Stream Input)
            {
                Graphics.ConsoleWriter ConsoleOut = new Graphics.ConsoleWriter("Calculate Pay");

                string TextInput = "";

                Graphics.Menu InputMenu = new Graphics.Menu();

                double Cars  = 0;
                double Hours = 0;
                double Temp  = 0;

                ConsoleOut.MakeMenu(InputMenu);

                Graphics.UIObject HeightInput = new Graphics.UIObject("Input Hours", ConsoleOut.XOffset("Input Hours".Length), 9, null);
                Graphics.UIObject WeightInput = new Graphics.UIObject("Input Cars", ConsoleOut.XOffset("Input Cars".Length), 10, null);
                Graphics.UIObject QuitButton  = new Graphics.UIObject("Go Back", ConsoleOut.XOffset("Go Back".Length), 11, null);

                InputMenu.AddItem(HeightInput);
                InputMenu.AddItem(WeightInput);
                InputMenu.AddItem(QuitButton);

                bool Quit = false;

                ConsoleKeyInfo InputKey;

                do
                {
                    ConsoleOut.WriteLine("Pay: " + (12 * Hours + 0.6 * Cars).ToString(), 7);

                    ConsoleOut.Draw();
                    InputKey = Console.ReadKey();
                    switch (InputKey.Key)
                    {
                    case ConsoleKey.UpArrow:
                        InputMenu.ChangeSelected(-1);
                        break;

                    case ConsoleKey.DownArrow:
                        InputMenu.ChangeSelected(1);
                        break;

                    case ConsoleKey.Enter:
                    {
                        if (InputMenu.GetSelected().Content == "Go Back")
                        {
                            Quit = true;
                        }
                        else if (InputMenu.GetSelected().Content == "Input Hours")
                        {
                            TextInput = Console.ReadLine();
                            double.TryParse(TextInput, out Temp);
                            Hours = Temp;
                        }
                        else
                        {
                            TextInput = Console.ReadLine();
                            double.TryParse(TextInput, out Temp);
                            Cars = Temp;
                        }
                    }
                    break;
                    }
                } while (!Quit);

                return(0);
            }