public void DirectCall(HandlerType handlerType) { MsgHandlerBase handler = null; MsgBase m = null; switch (handlerType) { case HandlerType.Chief: handler = new PoliceChief("MacMahon"); m = new ChiefMsg(); break; case HandlerType.Patrol: handler = new PolicePatrol("Car102"); m = new PatrolMsg(); break; } Clock.Timer.Restart(); handler.ReferencePoint(m); // clean up instance handler.UnregisterHandlers(); handler = null; }
void CheckCreatePatrolInstances() { if (_Patrols == null) { _Patrols = new PolicePatrol[2]; } if (_Patrols[0] == null) { _Patrols[0] = new PolicePatrol("Car102", true); } if (_Patrols[1] == null) { _Patrols[1] = new PolicePatrol("Car209", true); } }