private void BuildRobot(FactoryQueueElement newElement) { FactoryStatusArg factoryStatusArg = new FactoryStatusArg(); factoryStatusArg.QueueBot = newElement; if (FactoryStatus != null) { FactoryStatus(this, factoryStatusArg); } BaseUnit robot = (BaseUnit)Activator.CreateInstance(newElement.Model); robot.UnitStatusChanged += robotUnitStatusChanged; robot.Status = RobotStatus.Built; }
private void robotUnitStatusChanged(object robot, EventArgs statusArgs) { StatusChangedEventArgs status = (StatusChangedEventArgs)statusArgs; if (status.NewStatus == RobotStatus.Built.ToString()) { ITestingUnit robotCast = (ITestingUnit)robot; Storage.Add(robotCast); Queue.Dequeue(); FactoryStatusArg factoryStatusArg = new FactoryStatusArg(); factoryStatusArg.Robot = robotCast; if (FactoryStatus != null) { FactoryStatus(this, factoryStatusArg); } } }