Exemplo n.º 1
0
        static void Main(string[] args)
        {
            // create a datastore
            var store = new DataStore();

            // create a menu
            var menu = new SMUtils.Menu();

            // call view to create user, and pass the new user to the store
            menu.AddOption('1', "Set User Details", () => store.SetUser(UserView.CreateUser()));
            // call view to show user, and pass the store user as an argument
            menu.AddOption('2', "Show User Details", () => UserView.ShowUser(store.User));

            // call view to create a movie, and use a function to add it to the store
            menu.AddOption('3', "Add Movie", () => store.AddMovie(MovieView.CreateMovie()));

            // call view to show movies and pass the list of movies from the store
            menu.AddOption('4', "Show Movies", () => MovieView.ShowMovies(store.Movies));

            // start running the menu
            menu.Start();

            // we get here after exiting the menu. Save the data to a json file
            store.SaveData();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var menu = new SMUtils.Menu();

            menu.AddOption('1', "Create Content Object", () =>
            {
                Console.WriteLine("Add your content: ");
                string data = Console.ReadLine();
                content     = new Content(data);
            });

            menu.AddOption('2', "Show Content", () =>
            {
                if (content != null)
                {
                    content.Print();
                }
            });

            menu.AddOption('3', "Add Parentheses", () =>
            {
                if (content != null)
                {
                    content = new Parentheses(content);
                }
            });

            menu.AddOption('4', "Add Brackets", AddBrackets);
            menu.AddOption('5', "Add Braces", AddBraces);

            menu.Start();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            NewsAgency Belga = new NewsAgency();

            NewsPaper Standaard = new NewsPaper("Standaard");
            NewsPaper NYTimes   = new NewsPaper("New York Times");

            var menu = new SMUtils.Menu();

            menu.AddOption('1', "Add Economic News", () =>
            {
                Console.WriteLine("Type your News Message:");
                var message = Console.ReadLine();
                Belga.PublishEconomicNews(message);
            });

            menu.AddOption('2', "Add Political News", () =>
            {
                Console.WriteLine("Type your News Message:");
                var message = Console.ReadLine();
                Belga.PublishPoliticalNews(message);
            });

            menu.AddOption('3', "Add Tech News", () =>
            {
                Console.WriteLine("Type your News Message:");
                var message = Console.ReadLine();
                Belga.PublishTechNews(message);
            });

            menu.Start();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            SMUtils.Menu mainMenu = new SMUtils.Menu();
            mainMenu.AddOption('1', "Show Status", ShowStatus);
            mainMenu.AddOption('2', "Select Target", SelectTarget);
            mainMenu.AddOption('3', "Control Avatar", ControlAvatar);
            mainMenu.AddOption('4', "Attack Target", AttackTarget);

            mainMenu.Start();
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            SMUtils.Menu menu = new SMUtils.Menu();
            menu.AddOption('1', "Enter Hero Mode", () => hero = true);
            menu.AddOption('2', "Exit Hero Mode", () => hero  = false);
            menu.AddOption('3', "Cast Healing Ball", castHealing);
            menu.AddOption('4', "Cast Damage Ball", castDamage);
            menu.AddOption('5', "Cast Shadow Ball", castShadow);

            menu.Start();
        }
Exemplo n.º 6
0
        static void ControlAvatar()
        {
            SMUtils.Menu menu = new SMUtils.Menu();
            menu.AddOption('1', "Control Hunter", () => { selected = hunter; Console.WriteLine(selected.Name + " is active"); });
            menu.AddOption('2', "Control Mage", () => { selected = mage; Console.WriteLine(selected.Name + " is active"); });
            menu.AddOption('3', "Control Paladin", () => { selected = paladin; Console.WriteLine(selected.Name + " is active"); });
            menu.AddOption('4', "Control Priest", () => { selected = priest; Console.WriteLine(selected.Name + " is active"); });
            menu.AddOption('5', "Control Warrior", () => { selected = warrior; Console.WriteLine(selected.Name + " is active"); });

            menu.Start();
        }
Exemplo n.º 7
0
        static void SelectTarget()
        {
            SMUtils.Menu menu = new SMUtils.Menu();
            menu.AddOption('1', "Select Hunter", () => { target = hunter; Console.WriteLine(target.Name + " is targetted"); });
            menu.AddOption('2', "Select Mage", () => { target = mage; Console.WriteLine(target.Name + " is targetted"); });
            menu.AddOption('3', "Select Paladin", () => { target = paladin; Console.WriteLine(target.Name + " is targetted"); });
            menu.AddOption('4', "Select Priest", () => { target = priest; Console.WriteLine(target.Name + " is targetted"); });
            menu.AddOption('5', "Select Warrior", () => { target = warrior; Console.WriteLine(target.Name + " is targetted"); });

            menu.Start();
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            IResource order = null;

            var menu = new SMUtils.Menu();

            menu.AddOption('1', "Pick a Drink", () =>
            {
                order          = null;
                var drinksMenu = new SMUtils.Menu();
                drinksMenu.AddOption('1', "House Blend", () => order = new HouseBlend());
                drinksMenu.AddOption('2', "Dark Roast", () => order  = new DarkRoast());
                drinksMenu.AddOption('3', "Espresso", () => order    = new Espresso());
                drinksMenu.AddOption('4', "Decaf", () => order       = new Decaf());
                drinksMenu.Start(true);
            });

            menu.AddOption('2', "Add Condiments", () =>
            {
                var condMenu = new SMUtils.Menu();
                condMenu.AddOption('1', "Add Soy", () =>
                {
                    order = new Soy(order);
                });
                condMenu.AddOption('2', "Add Milk", () =>
                {
                    order = new Milk(order);
                });
                condMenu.AddOption('3', "Add Mocha", () =>
                {
                    order = new Mocha(order);
                });
                condMenu.AddOption('4', "Add Cream", () =>
                {
                    order = new Cream(order);
                });
                condMenu.Start();
            });

            menu.AddOption('3', "Print Receipt", () =>
            {
                if (order == null)
                {
                    Console.WriteLine("You did not order anything");
                }
                else
                {
                    order.PrintReceipt();
                    Console.WriteLine("Total:\t\t" + order.Cost());
                }
            });

            menu.Start();
        }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            Context.Get.Database.EnsureCreated();

            var menu = new SMUtils.Menu();

            menu.AddOption('1', "Add Queen", AddQueen);
            menu.AddOption('2', "View Queens", ViewQueens);
            menu.AddOption('3', "Add Hive", AddHive);
            menu.AddOption('4', "View Hives", ViewHives);
            menu.AddOption('5', "Add Ant", AddAnt);
            menu.Start();
        }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            var menu = new SMUtils.Menu();

            menu.AddOption('1', "Select account for Forlong the Fat", SelectAccount1);
            menu.AddOption('2', "Select account for Samwise Gamgee", SelectAccount2);
            menu.AddOption('3', "Select account for Tom Bombadil", SelectAccount3);

            submenu = new SMUtils.Menu();
            submenu.AddOption('1', "Show Account Details", ShowAccountDetails);
            submenu.AddOption('2', "Buy a new Item", BuyItem);

            menu.Start();
        }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            var menu = new SMUtils.Menu();

            menu.AddOption('1', "Draw Circles", () => factory = new CircleFactory());
            menu.AddOption('2', "Draw Squares", () => factory = new SquareFactory());
            menu.AddOption('3', "Draw Lines", () => factory   = new LineFactory());

            menu.AddOption('4', "Draw small shape", drawSmallShape);
            menu.AddOption('5', "Draw medium shape", drawMediumShape);
            menu.AddOption('6', "Draw large shape", drawLargeShape);

            menu.AddOption('7', "Print list of shapes", printShapes);
            menu.Start();
        }
Exemplo n.º 12
0
        static void Main(string[] args)
        {
            var player = new Player();

            AudioPlayer  audioPlayer  = new AudioPlayer();
            XPBar        xpBar        = new XPBar();
            Achievements achievements = new Achievements();

            var menu = new SMUtils.Menu();

            menu.AddOption('1', "Punch the Enemy", () => player.PunchEnemy());
            menu.AddOption('2', "Pick up Rock", () => player.PickupItem());
            menu.AddOption('3', "Drink Health Potion", () => player.DrinkHealthPotion());
            menu.AddOption('4', "Drink Poison", () => player.DrinkPoison());
            menu.AddOption('5', "Plant Carrot", () => player.Plant("Carrot"));
            menu.AddOption('6', "Plant Avocado", () => player.Plant("Avocado"));

            menu.Start();
        }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            IDamageTaker player = new Player();
            var          random = new Random();

            var menu = new SMUtils.Menu();

            menu.AddOption('1', "Fire!", () =>
            {
                IProjectile projectile = null;

                // create a projectile here

                if (projectile != null)
                {
                    player.AttackWith(projectile);
                }

                player.PrintStatus();
            });

            menu.AddOption('2', "Add Basic Shield", () =>
            {
                Console.WriteLine("Basic Shield Applied");
            });

            menu.AddOption('3', "Add Fire Shield", () =>
            {
                Console.WriteLine("Fire Shield Applied");
            });

            menu.AddOption('4', "Add Arcane Shield", () =>
            {
                Console.WriteLine("Arcane Shield Applied");
            });

            menu.AddOption('5', "Add SuperShield", () =>
            {
                Console.WriteLine("Superior Shield Applied");
            });

            menu.Start();
        }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            var menu = new SMUtils.Menu();

            // voeg oefeningen to door een callback naar een functie
            menu.AddOption('1', "Voer Oef1 uit", DoOef1);

            // of gebruik inline functies
            menu.AddOption('2', "Voer Oef1 anders uit",
                           () =>
            {
                if (Oef1.Oefening() == true)
                {
                    Console.WriteLine("This is correct!");
                }
            });


            menu.Start();
        }
Exemplo n.º 15
0
        public static Data.Models.Movie CreateMovie()
        {
            var movie = new Data.Models.Movie();
            Console.Write("Enter a movie Name: ");
            movie.Name = Console.ReadLine();

            Console.Write("Year of Release: ");
            movie.Year = Convert.ToInt32(Console.ReadLine());

            var menu = new SMUtils.Menu();
            menu.AddOption('1', "Fantasy", () => movie.Genre = Data.Models.Genre.Fantasy);
            menu.AddOption('2', "SciFi", () => movie.Genre = Data.Models.Genre.SciFi);
            menu.AddOption('3', "Anime", () => movie.Genre = Data.Models.Genre.Anime);
            menu.AddOption('4', "Steampunk", () => movie.Genre = Data.Models.Genre.Steampunk);
            menu.AddOption('5', "Shenmo", () => movie.Genre = Data.Models.Genre.Shenmo);
            menu.AddOption('6', "Other", () => movie.Genre = Data.Models.Genre.Other);
            menu.Start(true);

            return movie;
        }
Exemplo n.º 16
0
        static void Main(string[] args)
        {
            NumberKeeper  nKeeper       = new NumberKeeper();
            HexDisplay    hexDisplay    = new HexDisplay();
            BinaryDisplay binaryDisplay = new BinaryDisplay();

            var menu = new SMUtils.Menu();

            menu.AddOption('1', "Enter Number", () => {
                try
                {
                    int number = Convert.ToInt32(Console.ReadLine());
                    nKeeper.SetNumber(number);
                } catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            });

            menu.Start();
        }
Exemplo n.º 17
0
        static void Main(string[] args)
        {
            IElement output = null;

            output = new Div(
                new Paragraph("Hello World")
                );

            // ***************
            // don't change the code below this line
            // ***************
            var menu = new SMUtils.Menu();

            menu.AddOption('1', "Show HTML Code in Terminal", () =>
            {
                // render our objects
                List <string> result = new List <string>();
                output.RenderContent(0, result);

                // show in terminal window
                result.ForEach(line => Console.WriteLine(line));
            });

            menu.AddOption('2', "Show Result in Browser", () =>
            {
                // render our objects
                List <string> result = new List <string>();
                output.RenderContent(0, result);

                // write all lines to a file
                System.IO.File.WriteAllLines("index.html", result);

                // open this file with the default browser
                System.Diagnostics.Process.Start("cmd", $"/c start index.html");
            });

            menu.Start();
        }
Exemplo n.º 18
0
 static void SelectAccount1()
 {
     selected = account1;
     submenu.Start();
 }