public MainFrame(FrameForm form, List <Bundle> bundles) { Assembly assembly = Assembly.GetExecutingAssembly(); this.form = form; this.form.SuspendLayout(); leftMenuBackground = new System.Drawing.SolidBrush(leftMenuBackgroundColor); logoMenuBackground = new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(255, 33, 37, 43)); logoPicture = new PictureBox { Name = "logoPicture", Size = new Size(55, 55), Location = new Point(22, 22), Image = Image.FromStream(assembly.GetManifestResourceStream("MinerGUI.Resources.logo.png")), BackColor = Color.FromArgb(255, 33, 37, 43), SizeMode = PictureBoxSizeMode.StretchImage }; miningMenuPoint = new MenuPoint("mining.png", new MainContent(form, bundles), assembly, leftMenuBackgroundColor, logoHeight + menuTopPadding, menuHeight, 0, menuWidth); hardwareMenuPoint = new MenuPoint("hardware.png", new HardwareContent(form, bundles), assembly, leftMenuBackgroundColor, logoHeight + menuTopPadding, menuHeight, 1, menuWidth); userMenuPoint = new MenuPoint("user.png", new UserContent(form, new UserForm()), assembly, leftMenuBackgroundColor, logoHeight + menuTopPadding, menuHeight, 2, menuWidth); settingsMenuPoint = new MenuPoint("settings.png", new SettingsContent(form, new SettingsForm()), assembly, leftMenuBackgroundColor, logoHeight + menuTopPadding, menuHeight, 3, menuWidth); supportMenuPoint = new MenuPoint("support.png", new SupportContent(form), assembly, leftMenuBackgroundColor, logoHeight + menuTopPadding, menuHeight, 4, menuWidth); menuPoints.Add(miningMenuPoint); menuPoints.Add(hardwareMenuPoint); menuPoints.Add(userMenuPoint); menuPoints.Add(settingsMenuPoint); menuPoints.Add(supportMenuPoint); this.form.ResumeLayout(true); }
private void ActivateNewMenuPoint(MenuPoint menuPoint, FrameForm form, Graphics gfx) { if (activeMenuPoint != menuPoint) { if (activeMenuPoint != null) { activeMenuPoint.Deactivate(form, gfx); } activeMenuPoint = menuPoint; activeMenuPoint.Activate(form, gfx); } }
static void Main(string[] args) { Company company = new Company(); //Prepared employees list { HourlyEmployee hourlyEmployee = new HourlyEmployee("Bob", 30, "Male", Employee.Position.HourlyEmployee, 8, 5); company.AddEmployee(hourlyEmployee, 0); hourlyEmployee = new HourlyEmployee("John", 27, "Male", Employee.Position.HourlyEmployee, 8, 5); company.AddEmployee(hourlyEmployee, 0); hourlyEmployee = new HourlyEmployee("Gyda", 22, "Female", Employee.Position.HourlyEmployee, 8, 5); company.AddEmployee(hourlyEmployee, 0); ///////////////////////////////////////////////////////////////// SalariedEmployee salariedEmployee = new SalariedEmployee("Arthur", 35, "Male", Employee.Position.SalariedEmployee, 15, 5); company.AddEmployee(salariedEmployee, 0); salariedEmployee = new SalariedEmployee("Cathy", 37, "Female", Employee.Position.SalariedEmployee, 15, 5); company.AddEmployee(salariedEmployee, 0); salariedEmployee = new SalariedEmployee("Isabella", 37, "Female", Employee.Position.SalariedEmployee, 15, 5); company.AddEmployee(salariedEmployee, 0); ///////////////////////////////////////////////////////////////// Manager manager = new Manager("Michael", 40, "Male", Employee.Position.Manager, 75, 1500); company.AddEmployee(manager, 0); manager = new Manager("Alex", 41, "Male", Employee.Position.Manager, 75, 1500); company.AddEmployee(manager, 0); ///////////////////////////////////////////////////////////////// Executive executive = new Executive("Thomas", 47, "Male", Employee.Position.Executive, 250); company.AddEmployee(executive, 0); } //Prepared unemployed persons list { HourlyEmployee hourlyEmployee = new HourlyEmployee("Tom", 20, "Male"); company.RemoveEmployee(hourlyEmployee, 0); hourlyEmployee = new HourlyEmployee("Mike", 22, "Male"); company.RemoveEmployee(hourlyEmployee, 0); } Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Welcome to the company manager!!!"); Console.ResetColor(); do { Menu(); MenuPoint choice = InputMenu(); if (choice == MenuPoint.Exit) { Console.WriteLine("Close the program..."); Console.ReadKey(); break; } switch (choice) { case MenuPoint.ShowEmployees: { company.ShowEmployees(); break; } case MenuPoint.ShowUnemployedPersons: { company.ShowUnemployedPersons(); break; } case MenuPoint.HireEmployee: { company.HireEmmployee(); break; } case MenuPoint.DismissEmployee: { company.DismissEmployee(); break; } case MenuPoint.PromoteEmployee: { company.PromoteEmployee(); break; } default: { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Unknown command!"); Console.ResetColor(); break; } } Console.WriteLine("Input any key to continue..."); Console.ReadKey(); Console.Clear(); } while (true); }
static void Main(string[] args) { ParkingManager park = new ParkingManager(); Action action; do { Menu(); MenuPoint condition = ChooseMenuPoint(); if (condition == MenuPoint.Exit) { break; } switch (condition) { case MenuPoint.Buy: { action = park.AddCar; WriteToLog("The car was bougth!"); break; } case MenuPoint.Sell: { action = park.SellCar; WriteToLog("The car was sold!"); break; } case MenuPoint.Show: { action = park.ShowCars; WriteToLog("The car list was showned!"); break; } case MenuPoint.Exit: { action = Exit; WriteToLog("Exit the program!"); break; } default: { action = Error; WriteToLog("There was a error!"); Console.WriteLine("Unknown command!"); break; } } action(); Console.WriteLine("Input any key to continue the program..."); Console.ReadKey(); Console.Clear(); } while (true); }