public static Page Create() { Page result = new Page(); result.AddElement(new Label() { ScaledX = 950, ScaledY = 100, ScaledWidth = 1500, Name = "MainMenuTitle", Content = "Welcome to the OpenDrive Simulator!", Shadow = true, Outline = true, FontSize = 66, }); var ListItems = new List <string>() { "Start simulation", "Manage scenarios", "Manage routes", "Settings" }; ItemList list = new ItemList() { Name = "MainMenuList", ScaledX = (Tools.ScreenWidth - 400) / 2, ScaledY = 760, ScaledWidth = 400, ScaledHeight = ListItems.Count * ItemList.C_ItemHeight, }; ListItems.ForEach(x => list.AddItem(x)); list.Selected += (s, e) => { switch ((s as Button).Content) { case "Start simulation": Application.GUI.SetPage(SelectScenariosMenu.Create()); break; case "Manage scenarios": Application.GUI.SetPage(ManageScenariosMenu.Create()); break; case "Manage routes": Application.Console.WriteLine("Selected Manage routes"); Application.GUI.SetPage(ManageRoutesMenu.Create()); break; case "Settings": Application.GUI.SetPage(SettingsMenu.Create()); break; } }; result.AddElement(list); return(result); }
public static Page Create(Scenario scenario) { Page result = new Page(); result.AddElement(new Label() { Name = "PartIDLabel", Content = "Participant ID:", TextColor = Application.ColorText, Shadow = true, Outline = true, FontSize = 34, ScaledWidth = 350, ScaledHeight = 75, ScaledX = 380, ScaledY = 450, }); var partInputField = new InputField() { Name = "NameInput", ScaledWidth = 700, ScaledHeight = 50, ScaledX = (Tools.ScreenWidth - 700) / 2, ScaledY = 450, Content = "", }; result.AddElement(partInputField); var abortBut = new Button() { ScaledX = 50, ScaledY = 950, ScaledWidth = 200, ScaledHeight = 50, Name = "abortBut", Content = "Abort", }; abortBut.Selected += (a, b) => Application.GUI.SetPage(SelectScenariosMenu.Create()); result.AddElement(abortBut); var startButton = new Button() { ScaledX = Tools.ScreenWidth - 250, ScaledY = 950, ScaledWidth = 200, ScaledHeight = 50, Name = "EditScenarioApplyBut", Content = "OK", }; startButton.Selected += (a, b) => { if (String.IsNullOrWhiteSpace(partInputField.Content)) { return; } scenario.Start(partInputField.Content); }; result.AddElement(startButton); return(result); }