private void handle(String metadata) { if (Program.CurrentState == Program.State.Running) { if ("quit".Equals(metadata)) { Console.WriteLine("Quitting..."); Program.CurrentState = Program.State.Deiniting; ServicesManager.Instance.GetService(ServiceTypes.Reader).Deinit(); return; } if ((command = MenuModel.getValidCommand(metadata)) != null) { Program.CurrentState = Program.State.Processing; if (!command.NeedArgs()) { command.Run(); printService.Send(new ServiceMessage(typeof(String), command.FinalMessage)); Program.CurrentState = Program.State.Running; } else { printService.Send(new ServiceMessage(typeof(String), command.PrintArgInfo())); } } else { SendGreetings(); } } else { if (command.NeedArgs()) { command.AddArg(metadata); if (!command.NeedArgs()) { command.Run(); printService.Send(new ServiceMessage(typeof(String), command.FinalMessage)); Program.CurrentState = Program.State.Running; } else { printService.Send(new ServiceMessage(typeof(String), command.PrintArgInfo())); } } } }