private void Run() { SmartMenu menu = new SmartMenu(); menu.LoadMenu(@"..\..\MenuSpec.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(); }
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(); }
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); }
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); }
private void Run() { SmartMenu menu = new SmartMenu(); menu.LoadMenu("TextFil.txt"); menu.Activate(); }
private void Run() { SmartMenu menu = new SmartMenu(); menu.LoadMenu("TestMenu.txt", new Binding()); menu.Activate(); }
private void Run() { SmartMenu menu = new SmartMenu(); menu.LoadMenu(@"C:\Users\Frank Andersen\source\Smartmenu\SmartMenuApp-master\SmartMenuApp\MenuSpec.txt"); menu.Activate(); }
private void Run() { SmartMenu menu = new SmartMenu(); menu.LoadMenu("MenuSpecEN.txt"); menu.Activate(); }
private void Run() { IBindings bindings = new Bindings(); SmartMenu menu = new SmartMenu(); menu.LoadMenu(false); menu.Activate(bindings); }
private void Run() { Bindings bindings = new Bindings(); SmartMenu menu = new SmartMenu(); menu.LoadMenu(":MenuSpec.txt"); menu.Activate(bindings); }
private void Run() { SmartMenu menu = new SmartMenu(); menu.LoadMenu("MenuSpec.txt"); Binding test = new Binding(); test.BindingTest(); menu.Activate(); }
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())); } }
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); }
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); }
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(); }
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(); }
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); }
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); }
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(); }
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); }
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); } }
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(); } }
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(); } }
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); }
private void Run() { SmartMenu menu = new SmartMenu(); Console.WriteLine("For Dansk: Tryk 1"); Console.WriteLine("For English: Press 2"); int.TryParse(Console.ReadLine(), out int r); if (r != 1 && r != 2) { Console.WriteLine("det indtastede input findes ikke."); Console.ReadLine(); } else { menu.Load(menu.ChooseLanguage(r)); menu.Activate(); } }
public bool Activate(SmartMenu smartMenu) { string description; if (Expense is Trip) { Trip trip = Expense as Trip; description = $"{trip.Title}\n{trip.DepartureDestination}\n{trip.DepartureDate}\n{trip.ArrivalDestination}\n{trip.ArrivalDate}\n{trip.Distance}"; } else { Expenditure trip = Expense as Expenditure; description = $"{trip.Title}\n{trip.ExpenseType}\n{trip.Cash}\n{trip.Date}\n{trip.Amount}"; } SmartMenu sm = new SmartMenu(ToString(), "Tilbage", description); sm.Activate(); return(false); }
private void Run() { SmartMenu menu = new SmartMenu(); Console.WriteLine("For Dansk: Tryk 1"); Console.WriteLine("For English: Press 2"); Console.WriteLine(" "); Console.Write(": "); int input = int.Parse(Console.ReadLine()); if (input != 1 && input != 2) { Console.Clear(); Console.WriteLine("Ups Farvel"); Console.ReadLine(); } else { menu.Load(menu.ChooseLanguage(input)); menu.Activate(); } }
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(); } }
public void TestCase1() { SmartMenu smartmenu = new SmartMenu(); Assert.AreEqual("Farvel", smartmenu.Activate()); }