示例#1
0
        public VehiclesSettingsViewModel(ICanvas canvas) : this()
        {
            canvas.Clear();
            _forklift   = canvas.FindElementByType <IForklift>();
            DrawingPath = new BezierDrawingPath(canvas)
            {
                IsMarkingEnabled    = true,
                IsBezierPathEnabled = true
            };

            SelectedVehicle = VehicleType.Forklift;
            canvas.SetDrawingPath(DrawingPath);
        }
示例#2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (_repaintThread == null)
     {
         Random    random   = new Random();
         IForklift forklift = (IForklift)Activator.CreateInstance(_types[comboBox1.SelectedIndex], new Coordinates(panel1.Width / 2 - 50, panel1.Height / 2, 20),
                                                                  new Coordinates(panel1.Width / 2 - 50, panel1.Height / 2, 30));
         List <Mechanic> mechanics = new List <Mechanic>();
         for (int i = 0; i < Convert.ToInt32(numericUpDown1.Value); i++)
         {
             mechanics.Add(new Mechanic(new Coordinates(135 + 158 * i, panel1.Height - 70, 20), new Coordinates(135 + 158 * i, panel1.Height - 70, 20),
                                        new Warehouse(new Coordinates(90 + 158 * i, 60, 0), Convert.ToInt32(numericUpDown2.Value), random)));
         }
         _emulator = new Emulator(forklift, mechanics);
         _emulator.Run();
         _repaintThread = new Thread(PanelRepaint)
         {
             IsBackground = true
         };
         _repaintThread.Start();
         button1.Text           = "Остановить";
         numericUpDown1.Enabled = false;
         numericUpDown2.Enabled = false;
         comboBox1.Enabled      = false;
     }
     else
     {
         _emulator.Abort();
         _repaintThread.Abort();
         _repaintThread         = null;
         button1.Text           = "Запустить";
         numericUpDown1.Enabled = true;
         numericUpDown2.Enabled = true;
         comboBox1.Enabled      = true;
     }
 }
示例#3
0
 public Emulator(IForklift forklift, List <Mechanic> mechanics)
 {
     Forklift  = forklift;
     Mechanics = mechanics;
     Threads   = new List <Thread>();
 }