//Cleaner but General_form should be just form /* public Start_sub_menu(int Sub_menu_width, General_form General_form, FontFamily Dosis_font_family, string[] Recent_projects) * { * this.BackColor = Color.FromArgb(255, 255, 255); * this.Size = new Size(250, General_form.Height); * this.Location = new Point(General_form.Width - Sub_menu_width, 0); * Initialize(General_form, Sub_menu_width, Dosis_font_family, Recent_projects); * General_form.SizeChanged += (object o, EventArgs EA) => { * this.Size = new Size(Sub_menu_width, General_form.Height); * this.Location = new Point(General_form.Width - Sub_menu_width, 0); * this.Controls.Clear(); * Initialize(General_form, Sub_menu_width, Dosis_font_family, Recent_projects); * }; * }*/ private void Initialize(Form Form, int Sub_menu_width, FontFamily Dosis_font_family, string[] Recent_projects) { Dictionary <string, int> menu = User_Controls.Config.standardSubMenu; Dictionary <string, int> startmenu = User_Controls.Config.startSubMenu; CurvedButtons Logo = new CurvedButtons(Form, 1); Logo.Location = new Point(menu["logoX"], menu["logoY"]); this.Controls.Add(Logo); CurvedButtons Divider1 = new CurvedButtons(); Divider1.Location = new Point(menu["deviderX"], menu["deviderY"]); this.Controls.Add(Divider1); Move_panel Drag_pad = new Move_panel(Form); this.Controls.Add(Drag_pad); PictureBox Project_header = new PictureBox(); Project_header.Size = new Size(startmenu["headerXsize"], startmenu["headerYsize"]); Project_header.SizeMode = PictureBoxSizeMode.StretchImage; Project_header.Location = new Point(startmenu["headerX"], startmenu["headerY"]); Project_header.Image = Image.FromFile("../../User Interface Recources/Recent_Project_Header.png"); this.Controls.Add(Project_header); int i = 0; foreach (string tekst in Recent_projects) { CurvedButtons Project = new CurvedButtons(new Size(startmenu["projectXsize"], startmenu["projectYsize"]), new Point(Sub_menu_width / 2 - startmenu["projectX"], startmenu["projectYbase"] + i * startmenu["projectYdiff"]), startmenu["projectButtonCurve"], "../../User Interface Recources/Custom_Button.png", tekst, Dosis_font_family, Form, Color.White); Project.Location = new Point(Sub_menu_width / 2 - startmenu["projectX"], startmenu["projectYbase"] + i * startmenu["projectYdiff"]); this.Controls.Add(Project); i++; } CurvedButtons Divider2 = new CurvedButtons(); Divider2.Location = new Point(startmenu["divider2X"], this.Height - startmenu["divider2Y"]); this.Controls.Add(Divider2); CurvedButtons About_button = new CurvedButtons(new Size(startmenu["projectXsize"], startmenu["projectYsize"]), new Point(Sub_menu_width / 2 - startmenu["aboutX"], Form.Height - startmenu["aboutY"]), startmenu["aboutCurve"], "../../User Interface Recources/Custom_Button.png", "About", Dosis_font_family, Form, this.BackColor); this.Controls.Add(About_button); }
//Cleaner maar General_form moet form zijn /* * public Build_sub_menu(int Sub_menu_width, General_form General_form, FontFamily Dosis_font_family) * { * this.BackColor = Color.FromArgb(255,255,255); * this.Size = new Size(250, General_form.Height); * this.Location = new Point(General_form.Width - Sub_menu_width, 0); * General_form.SizeChanged += (object o, EventArgs EA) => { * this.Size = new Size(Sub_menu_width, General_form.Height); * this.Location = new Point(General_form.Width - Sub_menu_width, 0); * this.Controls.Clear(); * Initialize(General_form, Sub_menu_width, Dosis_font_family); * }; * Initialize(General_form, Sub_menu_width, Dosis_font_family); * }*/ private void Initialize(Form Form, int Sub_menu_width, FontFamily Dosis_font_family) { Dictionary <string, int> menu = User_Controls.Config.buildSubMenu; CurvedButtons Logo = new CurvedButtons(Form, 1); Logo.Location = new Point(User_Controls.Config.standardSubMenu["logoX"], User_Controls.Config.standardSubMenu["logoY"]); this.Controls.Add(Logo); CurvedButtons Divider1 = new CurvedButtons(); Divider1.Location = new Point(User_Controls.Config.standardSubMenu["deviderX"], User_Controls.Config.standardSubMenu["deviderY"]); this.Controls.Add(Divider1); Move_panel Drag_pad = new Move_panel(Form); this.Controls.Add(Drag_pad); PictureBox Elements_header = new PictureBox(); Elements_header.Size = new Size(menu["elementHeaderSizeX"], menu["elementHeaderSizeY"]); //elementHeaderSizeX , //elementHeaderSizeY Elements_header.SizeMode = PictureBoxSizeMode.StretchImage; Elements_header.Location = new Point(menu["elementHeaderX"], menu["elementHeaderY"]); //elementHeaderX, //elementHeaderY Elements_header.Image = Image.FromFile("../../User Interface Recources/Elements_Header.png"); this.Controls.Add(Elements_header); //buttonSizeL //buttonSizeS //devider2 //devider4 //devider3 /simStartSizeX /simStartSizeY / simStartX / simStartY / buttonL / buttonS / buttonHome / buttonSave / buttonRoad / buttonLight / buttonSign / buttonBuilding CurvedButtons Home_button = new CurvedButtons(new Size(menu["buttonSizeL"], menu["buttonSizeS"]), new Point(Sub_menu_width / 2 - menu["buttonHome"], menu["buttonL"]), 25, "../../User Interface Recources/Custom_Button_Small.png", "Home", Dosis_font_family, Form, this.BackColor); Home_button.Click += (object o, EventArgs EA) => { General_Form.Main.UserInterface.Menu_to_start(); }; this.Controls.Add(Home_button); CurvedButtons Save_button = new CurvedButtons(new Size(menu["buttonSizeL"], menu["buttonSizeS"]), new Point(Sub_menu_width / 2 + menu["buttonSave"], menu["buttonL"]), 25, "../../User Interface Recources/Custom_Button_Small.png", "Save", Dosis_font_family, Form, this.BackColor); Save_button.Click += (object o, EventArgs EA) => { }; this.Controls.Add(Save_button); CurvedButtons Road_button = new CurvedButtons(new Size(menu["buttonSizeS"], menu["buttonSizeS"]), new Point(Sub_menu_width / 2 - menu["buttonRoad"], menu["buttonS"]), 25, "../../User Interface Recources/Road_Button.png", this.BackColor); Road_button.Click += (object o, EventArgs EA) => { General_Form.Main.BuildScreen.SwitchSubMenus("Roads"); }; this.Controls.Add(Road_button); CurvedButtons Light_button = new CurvedButtons(new Size(menu["buttonSizeS"], menu["buttonSizeS"]), new Point(Sub_menu_width / 2 - menu["buttonLight"], menu["buttonS"]), 25, "../../User Interface Recources/Traffic_Light_Button.png", this.BackColor); Light_button.Click += (object o, EventArgs EA) => { General_Form.Main.BuildScreen.SwitchSubMenus("Lights"); }; this.Controls.Add(Light_button); CurvedButtons Sign_button = new CurvedButtons(new Size(menu["buttonSizeS"], menu["buttonSizeS"]), new Point(Sub_menu_width / 2 + menu["buttonSign"], menu["buttonS"]), 25, "../../User Interface Recources/Speed_Sign_Button.png", this.BackColor); Sign_button.Click += (object o, EventArgs EA) => { General_Form.Main.BuildScreen.SwitchSubMenus("Signs"); }; this.Controls.Add(Sign_button); CurvedButtons Building_button = new CurvedButtons(new Size(menu["buttonSizeS"], menu["buttonSizeS"]), new Point(Sub_menu_width / 2 + menu["buttonBuilding"], menu["buttonS"]), 25, "../../User Interface Recources/Building_Button.png", this.BackColor); Building_button.Click += (object o, EventArgs EA) => { General_Form.Main.BuildScreen.SwitchSubMenus("Buildings"); }; this.Controls.Add(Building_button); CurvedButtons Divider2 = new CurvedButtons(); Divider2.Location = new Point(0, menu["devider2"]); //devider2 this.Controls.Add(Divider2); CurvedButtons Divider4 = new CurvedButtons(); Divider4.Location = new Point(0, Form.Height - menu["devider4"]); //devider4 this.Controls.Add(Divider4); CurvedButtons Start_sim_button = new CurvedButtons(new Size(menu["simStartSizeX"], menu["simStartSizeY"]), new Point(Sub_menu_width / 2 - menu["simStartX"], Form.Height - menu["simStartY"]), 25, "../../User Interface Recources/Custom_Button.png", "Start simulation", Dosis_font_family, Form, this.BackColor); Start_sim_button.Click += (object o, EventArgs EA) => { General_Form.Main.MenuController.SwitchToSimulation();; }; this.Controls.Add(Start_sim_button); CurvedButtons Undo_button = new CurvedButtons(new Size(30, 30), new Point(10, Form.Height - menu["simStartY"]), 25, "../../User Interface Recources/Reset_Simulation_Button.png", this.BackColor); this.Controls.Add(Undo_button); CurvedButtons Divider3 = new CurvedButtons(); Divider3.Location = new Point(0, menu["devider3"]); //devider3 this.Controls.Add(Divider3); }
//Cleaner but General_form should be just form /*public bool Simulation_state_playing = false; * public Simulation_sub_menu(int Sub_menu_width, General_form General_form, FontFamily Dosis_font_family) * { * this.BackColor = Color.FromArgb(255,255,255); * this.Size = new Size(250,General_form.Height); * this.Location = new Point(General_form.Width-Sub_menu_width, General_form.Height); * this.AutoScroll = true; * Initialize(General_form, Sub_menu_width, Dosis_font_family); * General_form.SizeChanged += (object o, EventArgs EA) => { * this.Size = new Size(Sub_menu_width, General_form.Height); * this.Location = new Point(General_form.Width - Sub_menu_width, 0); * this.Controls.Clear(); * Initialize(General_form, Sub_menu_width, Dosis_font_family); * }; * }*/ private void Initialize(Form Form, int Sub_menu_width, FontFamily Dosis_font_family) { Dictionary <string, int> menu = User_Controls.Config.simSubMenu; CurvedButtons Logo = new CurvedButtons(Form, 1); Logo.Location = new Point(User_Controls.Config.standardSubMenu["logoX"], User_Controls.Config.standardSubMenu["logoY"]); this.Controls.Add(Logo); Move_panel Drag_pad = new Move_panel(Form); this.Controls.Add(Drag_pad); CurvedButtons Divider1 = new CurvedButtons(); Divider1.Location = new Point(User_Controls.Config.standardSubMenu["deviderX"], User_Controls.Config.standardSubMenu["logoY"]); this.Controls.Add(Divider1); CurvedButtons Settings_header = new CurvedButtons(new Size(menu["settingsHeaderSizeX"], menu["settingsHeaderSizeY"]), //settingsHeaderSizeX //settingsHeaderSizeY new Point(menu["settingsHeaderX"], menu["settingsHeaderY"]), "../../User Interface Recources/Settings_Header.png"); //settingsHeaderX //settingsHeaderY this.Controls.Add(Settings_header); //ButtonSize //ButtonY int _buttonSize = menu["ButtonSize"]; CurvedButtons Weather = new CurvedButtons(new Size(_buttonSize, _buttonSize), new Point(menu["buttonStart"], menu["ButtonY"]), 30, //weatherX "../../User Interface Recources/Weather_Setting_Button.png", this.BackColor); this.Controls.Add(Weather); Weather.Click += (object obj, EventArgs args) => { General_Form.Main.SimulationScreen.SwitchSubMenus("Weather");; }; CurvedButtons Vehicle = new CurvedButtons(new Size(_buttonSize, _buttonSize), new Point(menu["buttonStart"] + menu["ButtonX"], menu["ButtonY"]), 30, //vehicleX "../../User Interface Recources/Vehicle_Setting_Button.png", this.BackColor); this.Controls.Add(Vehicle); Vehicle.Click += (object obj, EventArgs args) => { General_Form.Main.SimulationScreen.SwitchSubMenus("Vehicle");; }; CurvedButtons Driver = new CurvedButtons(new Size(_buttonSize, _buttonSize), new Point(menu["buttonStart"] + menu["ButtonX"] * 2, menu["ButtonY"]), 30, //driverX "../../User Interface Recources/Driver_Setting_Button.png", this.BackColor); this.Controls.Add(Driver); Driver.Click += (object obj, EventArgs args) => { General_Form.Main.SimulationScreen.SwitchSubMenus("Driver");; }; CurvedButtons Divider2 = new CurvedButtons(); Divider2.Location = new Point(0, menu["devider2"]); //devider2 this.Controls.Add(Divider2); CurvedButtons Divider3 = new CurvedButtons(); Divider3.Location = new Point(0, this.Height - menu["devider3"]); //devider3 this.Controls.Add(Divider3); CurvedButtons Start = new CurvedButtons(new Size(_buttonSize, _buttonSize), //controlsX, controlsY new Point(menu["buttonStart"], Form.Height - menu["controlsY"]), 35, "../../User Interface Recources/Play_Simulation_Button.png", this.BackColor); this.Controls.Add(Start); Start.BringToFront(); CurvedButtons Pause = new CurvedButtons(new Size(60, 60), new Point(20, Form.Height - 80), 35, "../../User Interface Recources/Pause_Button.png", this.BackColor); Pause.Hide(); this.Controls.Add(Pause); Pause.BringToFront(); Pause.Click += (object o, EventArgs EA) => { Pause.Hide(); Start.Show(); General_Form.Main.UserInterface.SimDataM.Stop_timer(); }; Start.Click += (object o, EventArgs EA) => { Start.Hide(); Pause.Show(); General_Form.Main.UserInterface.SimDataM.Start_timer(); }; CurvedButtons Reset = new CurvedButtons(new Size(_buttonSize, _buttonSize), new Point(menu["buttonStart"] + menu["ButtonX"], Form.Height - menu["controlsY"]), 35, "../../User Interface Recources/Reset_Simulation_Button.png", this.BackColor); this.Controls.Add(Reset); CurvedButtons Stop = new CurvedButtons(new Size(_buttonSize, _buttonSize), new Point(menu["buttonStart"] + menu["ButtonX"] * 2, Form.Height - menu["controlsY"]), 35, "../../User Interface Recources/Stop_Simulation_Button.png", this.BackColor); this.Controls.Add(Stop); Stop.Click += (object obj, EventArgs args) => { General_Form.Main.SwitchControllers(General_Form.Main.BuildScreen); General_Form.Main.UserInterface.SimDataM.Reset_timer(); Pause.Hide(); Start.Show(); }; CurvedButtons SimulationSpeed_header = new CurvedButtons(new Size(menu["speedHeaderSizeX"], menu["speedHeaderSizeY"]), //speedHeaderSizeX //speedHeaderSizeY new Point(menu["speedHeaderX"], this.Height - menu["speedHeaderY"]), "../../User Interface Recources/Simulation_Speed_Header.png"); //speedHeaderX //speedHeaderY this.Controls.Add(SimulationSpeed_header); Slider SimulationSpeed = new Slider(new Point(menu["speedX"], this.Height - menu["speedY"]), 0, 100); //speedX //speedY this.Controls.Add(SimulationSpeed); Reset.BringToFront(); Reset.Click += (object o, EventArgs EA) => { if (Pause.Visible) { General_Form.Main.UserInterface.SimDataM.Reset_timer(); Pause.Hide(); Start.Show(); SimulationSpeed.Value = 1; } else if (Start.Visible && General_Form.Main.UserInterface.SimDataM.Stopwatch.Elapsed.ToString() != "00:00:00") { General_Form.Main.UserInterface.SimDataM.Reset_timer(); SimulationSpeed.Value = 1; } }; }