示例#1
0
        private void Run()
        {
            // Make bindings and bind options
            Bindings  binds = new Bindings();
            SmartMenu menu  = new SmartMenu(binds);

            menu.lang = "en";
            binds.Bind("this", This);
            binds.Bind("that", That);
            binds.Bind("something", Something);
            binds.Bind("another", Another);
            binds.Bind("lang", changeLang);

            menu.LoadMenu("MenuSpec.txt");
            menu.Activate();

            void changeLang()
            {
                if (menu.lang == "en")
                {
                    Console.Write("Danish or English? (EN for English and DA for Danish): ");
                }
                else
                {
                    Console.Write("Dansk eller Engelsk ? (EN for Engelsk and DA for Dansk): ");
                }

                string answer = Console.ReadLine();

                if (answer.ToLower().Trim() == "en")
                {
                    menu.LoadMenu("MenuSpec.txt");
                    menu.lang = "en";
                }
                else if (answer.ToLower().Trim() == "da")
                {
                    menu.LoadMenu("DAMenuSpec.txt");
                    menu.lang = "da";
                }
            }

            void Something()
            {
                if (menu.lang == "en")
                {
                    Console.WriteLine("What do you want to do?");
                }
                else
                {
                    Console.WriteLine("Hvad vil du gøre?");
                }

                Console.WriteLine(Functions.DoSomething(Console.ReadLine()));
            }
        }
示例#2
0
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

            menu.LoadMenu("MenuSpecEN.txt");
            menu.Activate();
        }
示例#3
0
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

            menu.LoadMenu(@"C:\Users\Frank Andersen\source\Smartmenu\SmartMenuApp-master\SmartMenuApp\MenuSpec.txt");
            menu.Activate();
        }
示例#4
0
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

            menu.LoadMenu("TextFil.txt");
            menu.Activate();
        }
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

            menu.LoadMenu(@"C:\Users\PC\Documents\EAL\Programmering\Projekt\SmartMenuApp.Code-master\SmartMenuLibrary\MenuSpec.txt");
            menu.Activate();
        }
示例#6
0
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

            menu.LoadMenu("TestMenu.txt", new Binding());
            menu.Activate();
        }
示例#7
0
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

            menu.LoadMenu(@"..\..\MenuSpec.txt");
            menu.Activate();
        }
示例#8
0
        private void Run()
        {
            IBindings bindings = new Bindings();
            SmartMenu menu     = new SmartMenu();

            menu.LoadMenu(false);
            menu.Activate(bindings);
        }
示例#9
0
        private void Run()
        {
            Bindings  bindings = new Bindings();
            SmartMenu menu     = new SmartMenu();

            menu.LoadMenu(":MenuSpec.txt");
            menu.Activate(bindings);
        }
示例#10
0
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

            menu.LoadMenu("MenuSpec.txt");
            Binding test = new Binding();

            test.BindingTest();
            menu.Activate();
        }
示例#11
0
        private void Run()
        {
            SmartMenu menu     = new SmartMenu();
            Bindings  bindings = new Bindings();

            //TODO: Be able to choose language.
            string language = menu.ChooseLanguage(out string errorPath, out string bindingsPath);

            menu.LoadMenu(language, errorPath);
            menu.Activate(bindings);
        }
示例#12
0
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

            string menuLanguage = menu.ChooseLanguage(out string errorPath, out string bindingsPath);

            Bindings bindings = new Bindings(bindingsPath);

            menu.LoadMenu(menuLanguage, errorPath);
            menu.Activate(bindings);
        }
示例#13
0
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

            Console.WriteLine("Vælg sprog / Choose language ");
            Console.WriteLine("For Dansk: Tryk 1 / For English press 2");
            string input = Console.ReadLine();

            int.TryParse(input, out int r);
            menu.LoadMenu(menu.ChooseLanguage(r));
            menu.Activate();
        }
示例#14
0
        static void Main(string[] args)
        {
            Bindings bindings = new Bindings();

            bindings.Bind("add", MenuPoints.Add);
            bindings.Bind("sub", MenuPoints.Subtract);
            bindings.Bind("multi", MenuPoints.Multiply);
            bindings.Bind("div", MenuPoints.Divide);
            bindings.Bind("sum", MenuPoints.Sum);
            bindings.Bind("min", MenuPoints.Minimum);
            bindings.Bind("max", MenuPoints.Maximum);
            SmartMenu smartMenu = new SmartMenu(bindings);

            smartMenu.LoadMenu("MenuSpec.txt");
            smartMenu.Activate();
        }
        static void Main(string[] args)
        {
            Bindings binding = new Bindings();
            Timer    Mytimer = new Timer();

            binding.bind("1", SetTimer);
            binding.bind("2", CancelTimer);
            binding.bind("3", RestartPC);
            binding.bind("4", ForceShutdown);
            binding.bind("5", Exit);

            SmartMenu menu = new SmartMenu(binding);

            menu.LoadMenu("menu.txt");
            menu.Activate();

            void SetTimer()
            {
                int duration;

                duration = Mytimer.HandleTime();
                Mytimer.SetTimer(duration);
            }

            void CancelTimer()
            {
                Mytimer.CancelTimer();
            }

            void RestartPC()
            {
                Mytimer.RestartPC();
            }

            void ForceShutdown()
            {
                Mytimer.ForceShutdown();
            }

            void Exit()
            {
                Environment.Exit(1);
            }
        }
示例#16
0
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

            Console.WriteLine("For Dansk: Tryk 1");
            Console.WriteLine("For English: Press 2");
            string input = Console.ReadLine();

            int.TryParse(input, out int r); // Tester om input fra brugeren er et tal
            if (r == 0)
            {
                Console.WriteLine("Farvel");
            }
            else
            {
                menu.LoadMenu(menu.ChooseLanguage(r));
                menu.Activate();
            }
        }
示例#17
0
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

            Console.WriteLine("Tryk 1 for Dansk");
            Console.WriteLine("Press 2 for English");
            string input = Console.ReadLine();

            int.TryParse(input, out int parsedinput);
            if (parsedinput != 1 && parsedinput != 2)
            {
                Console.WriteLine("Fejlagtigt Input");
            }
            else
            {
                menu.LoadMenu(menu.Sprog(parsedinput));
                menu.Activate();
            }
        }
示例#18
0
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

            Console.WriteLine("Vælg sprog  / Choose language");
            Console.WriteLine("");
            Console.WriteLine(" 1. Dansk");
            Console.WriteLine(" 2. English");
            Console.WriteLine("");
            Console.WriteLine("(Vælg menupunkt 1 eller 2 / Choose menu item 1 or 2)");
            string input = Console.ReadLine();

            int.TryParse(input, out int parsedinput);
            if (parsedinput == 0 || parsedinput > 2)
            {
                Console.WriteLine("Fejlagtigt Input");
            }
            else
            {
                menu.LoadMenu(menu.Sprog(parsedinput));
                menu.Activate();
            }
        }
示例#19
0
        public void CreateNewTranslator()
        {
            menu = new SmartMenu(null);  // Bindings are never actually called so there's no reason to create a Binding object.

            menu.LoadMenu("MenuSpec.txt");
        }
示例#20
0
 public void TestInitialize()
 {
     menu = new SmartMenu();
     menu.LoadMenu("MenuSpec.txt");
 }
示例#21
0
        public void TestMethod1()
        {
            SmartMenu smart = new SmartMenu();

            Assert.AreEqual(true, smart.LoadMenu(@"D:\datamatiker\Calculator\SmartMenuLibrary\SmartMenuLibrary\MenuSpec.txt"));
        }
示例#22
0
        public void TestMethod1()
        {
            SmartMenu smart = new SmartMenu();

            Assert.AreEqual(true, smart.LoadMenu("MenuSpec.txt"));
        }
示例#23
0
 public void SetupForTest()
 {
     menu = new SmartMenu();
     menu.LoadMenu(true);
 }