Пример #1
0
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

            menu.LoadMenu(@"..\..\MenuSpec.txt");
            menu.Activate();
        }
Пример #2
0
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

            menu.LoadMenu("TextFil.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
        public bool Activate(SmartMenu smartMenu)
        {
            string description = string.Format(
                "{0}\n{1}\n{2}\n{3}\n{4}",
                Expenditure.Title,
                Expenditure.ExpenseType,
                Expenditure.Cash,
                Expenditure.Date,
                Expenditure.Amount
                );

            SmartMenu sm = new SmartMenu(Expenditure.Title, "Tilbage", description);

            sm.Attach(new RemoveExpense(Compensation, Expenditure));

            int countExpenses = Compensation.CountAppendices();

            sm.Activate();

            if (countExpenses > Compensation.CountAppendices())
            {
                smartMenu.Detach(this);
            }

            return(false);
        }
Пример #5
0
        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
        static void Main(string[] args)
        {
            AccessPoint accessPoint = null;

            do
            {
                int employeeId = Request.Int("Hvad er dit medarbejder ID?");
                try
                {
                    accessPoint = new AccessPoint(employeeId);
                }
                catch (EntryPointNotFoundException)
                {
                    Console.WriteLine("Kunne ikke finde data for medarbejder ID " + employeeId);
                    Console.ReadKey();
                }
                catch (SqlException e)
                {
                    Console.WriteLine("Noget gik galt mellem serveren & programmet: " + e);
                    Console.ReadKey();
                }
            } while (accessPoint is null);

            Department department = accessPoint.Department;

            SmartMenu smartMenu = new SmartMenu("Afdeling " + department.Id, "Luk programmet");

            smartMenu.Attach(new ShowAllCompensations(accessPoint));

            smartMenu.Attach(new CreateDriving(accessPoint));

            smartMenu.Attach(new CreateTravel(accessPoint));

            smartMenu.Activate();
        }
Пример #7
0
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

            menu.LoadMenu("TestMenu.txt", new Binding());
            menu.Activate();
        }
Пример #8
0
        public bool Activate(SmartMenu smartMenu)
        {
            string description = string.Format(
                "{0}\n{1}\n{2}\n{3}\n{4}\n{5}",
                trip.Title,
                trip.DepartureDestination,
                trip.DepartureDate,
                trip.ArrivalDestination,
                trip.ArrivalDate,
                trip.Distance
                );

            SmartMenu sm = new SmartMenu(trip.Title, "Tilbage", description);

            sm.Attach(new RemoveExpense(Compensation, trip));


            int countExpenses = Compensation.CountAppendices();

            sm.Activate();

            if (countExpenses > Compensation.CountAppendices())
            {
                smartMenu.Detach(this);
            }

            return(false);
        }
Пример #9
0
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

            menu.LoadMenu("MenuSpecEN.txt");
            menu.Activate();
        }
Пример #10
0
        private void Run()
        {
            Bindings  bindings = new Bindings();
            SmartMenu menu     = new SmartMenu();

            menu.LoadMenu(":MenuSpec.txt");
            menu.Activate(bindings);
        }
Пример #11
0
        private void Run()
        {
            IBindings bindings = new Bindings();
            SmartMenu menu     = new SmartMenu();

            menu.LoadMenu(false);
            menu.Activate(bindings);
        }
Пример #12
0
        private void Run()
        {
            SmartMenu menu = new SmartMenu();

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

            test.BindingTest();
            menu.Activate();
        }
Пример #13
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()));
            }
        }
Пример #14
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);
        }
Пример #15
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);
        }
Пример #16
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();
        }
Пример #17
0
        static void Main(string[] args)
        {
            SmartMenu sm = new SmartMenu("Ex42", "Close program");

            sm.Attach(new InsertPet());
            sm.Attach(new ShowAllPets());
            sm.Attach(new AddAPetOWner());
            sm.Attach(new FindOwnerByLastName());
            sm.Attach(new FindOwnerByEmail());

            sm.Activate();
        }
Пример #18
0
        public bool Activate(SmartMenu smartMenu)
        {
            Controller ctrl = new Controller();

            string lastName    = Request.String($"Last name");
            string firstName   = Request.String($"First name");
            string phoneNumber = Request.String($"Phonenumber");
            string email       = Request.String($"Email");

            ctrl.InsertPetOwner(lastName, firstName, phoneNumber, email);

            return(false);
        }
        public bool Activate(SmartMenu smartMenu)
        {
            SmartMenu sm = new SmartMenu(ToString(), "Tilbage");

            foreach (Appendix expense in compensation.GetAppendices())
            {
                sm.Attach(new ShowExpense(expense));
            }

            sm.Activate();

            return(false);
        }
Пример #20
0
        public bool Activate(SmartMenu smartMenu)
        {
            Controller ctrl = new Controller();

            string name    = Request.String("Name on the pet");
            string type    = Request.String($"Type on {name}");
            string breed   = Request.String($"Breed on {name}");
            string weight  = Request.String($"Weight on {name}");
            string ownerId = Request.String($"Owner id on {name}");

            ctrl.InsertPet(name, type, breed, weight, ownerId);

            return(false);
        }
Пример #21
0
        public bool Activate(SmartMenu smartMenu)
        {
            List <Compensation> compensations = AccessPoint.Instance.GetAllCompensations();

            SmartMenu sm = new SmartMenu("Alle godtgørelser", "Tilbage");

            foreach (Compensation compensation in compensations)
            {
                sm.Attach(new ShowCompensation(compensation));
            }

            sm.Activate();

            return(false);
        }
Пример #22
0
        public bool Activate(SmartMenu smartMenu)
        {
            string  title               = Request.String("Kørsels godtgørelse titel");
            string  numberPlate         = Request.String("Nummerplade");
            Driving drivingCompensation = new Driving(title, accessPoint.Employee, numberPlate);

            SmartMenu sm = new SmartMenu(drivingCompensation.Title, "Anullér");

            sm.Attach(new AddTrip(drivingCompensation));

            sm.Attach(new AddCompensationToDepartment(accessPoint.Department, drivingCompensation));

            sm.Activate();

            return(false);
        }
Пример #23
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();
        }
Пример #24
0
        public bool Activate(SmartMenu smartMenu)
        {
            string   title  = Request.String("Titel på udgiften");
            DateTime date   = Request.DateTime("Tidspunkt");
            double   amount = Request.Double(string.Format("Sum af udgiften {0}", title));

            Expenditure.Type type = Request.Enum <Expenditure.Type>("Type");
            bool             cash = Request.Bool("Betalte du med kontant?");

            Expenditure expenditure = new Expenditure(title, date, amount, type, cash, Travel);

            Travel.AddAppendix(expenditure);

            smartMenu.Attach(new EditExpenditure(Travel, expenditure));

            return(false);
        }
Пример #25
0
        public bool Activate(SmartMenu smartMenu)
        {
            string   title = Request.String("Titel på bekostningen");
            string   departureDestination = Request.String("Hvor kørte du fra?");
            DateTime departureDate        = Request.DateTime(string.Format("Hvornår kørte du fra {0}?", departureDestination));
            string   arrivalDestination   = Request.String("Hvor kørte du til?");
            DateTime arrivalDate          = Request.DateTime(string.Format("Hvornår kom du til {0}?", arrivalDestination));
            int      distance             = Request.Int("Hvor mange kilometer (i hele tal)?");

            Trip drivingExpense = new Trip(title, departureDestination, departureDate, arrivalDestination, arrivalDate, distance, DrivingCompensation);

            DrivingCompensation.AddAppendix(drivingExpense);

            smartMenu.Attach(new EditTrip(DrivingCompensation, drivingExpense));

            return(false);
        }
Пример #26
0
        public bool Activate(SmartMenu smartMenu)
        {
            Console.Clear();
            Controller ctrl = new Controller();

            List <Pet> pets = ctrl.ShowAllPets();

            foreach (Pet pet in pets)
            {
                Console.WriteLine(pet.Name);
            }

            Console.WriteLine();
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey(true);

            return(false);
        }
        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);
            }
        }
Пример #28
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();
            }
        }
Пример #29
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();
            }
        }
Пример #30
0
        public bool Activate(SmartMenu smartMenu)
        {
            string   title         = Request.String("Rejse godtgørelsens titel:");
            DateTime departureDate = Request.DateTime("Hvornår tog du afsted?");
            DateTime returnDate    = Request.DateTime("Hvorn år kom du hjem?");
            bool     overNightStay = Request.Bool("Overnattede du under rejsen?");
            double   credit        = Request.Double("Hvor meget i kontant havde du med?");
            Travel   travel        = new Travel(title, AccessPoint.Instance.Employee, departureDate, returnDate, overNightStay, credit);

            SmartMenu sm = new SmartMenu(travel.Title, "Anullér");

            sm.Attach(new AddExpenditure(travel));

            sm.Attach(new AddCompensationToDepartment(AccessPoint.Instance.Department, travel));

            sm.Activate();

            return(false);
        }