static void Main(string[] args) { ElevatorRuntime runtime = new ElevatorRuntime(); runtime.ExecutablePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", "").Replace("/", "\\")); if (args != null && args.Length > 0 && args[0] == "--run") { runtime.RunMode = ElevatorRuntime.RunModes.Competition; runtime.Run(new DefaultAlgorithm()); } else if (args != null && args.Length > 0 && args[0] == "--rnd") { Application.EnableVisualStyles(); runtime.RunMode = ElevatorRuntime.RunModes.Random; runtime.CycleDelay = 250; Task.Run(() => { runtime.Run(new DefaultAlgorithm()); }); Application.Run(new Building(runtime)); } else { Application.EnableVisualStyles(); runtime.RunMode = ElevatorRuntime.RunModes.UI; runtime.CycleDelay = 1000; Task.Run(() => { runtime.Run(new DefaultAlgorithm()); }); Application.Run(new Building(runtime)); } }
public Building(ElevatorRuntime runtime) { this.runtime = runtime; InitializeComponent(); pictureBox1.Paint += pictureBox1_Paint; pictureBox1.MouseDown += pictureBox1_MouseDown; pictureBox1.MouseMove += pictureBox1_MouseMove; pictureBox1.MouseUp += pictureBox1_MouseUp; Timer t = new Timer() { Enabled = true, Interval = 100 }; t.Tick += t_Tick; t.Start(); }