public TerminalController(TerminalApi terminalCore)
 {
     _terminalCore = terminalCore;
 }
        /// <summary>
        /// Pass the command string to the terminal core for execution, then examine the resulting instructions.
        /// </summary>
        /// <param name="commandString">The command string passed from the command line.</param>
        private static void InvokeCommand(string commandString)
        {
            // Instantiate the Ninject kernel and pass in the pre-defined Ninject Module from Terminal.Core.Ninject.
            var kernel = new StandardKernel(new TerminalBindings(false));
            // Grab the terminal API object from Ninject.
            _terminalApi = kernel.Get<TerminalApi>();

            // Set the username on the API. This tells the API if someone is logged in or not. If nobody is logged in
            // then _username is null by default;
            _terminalApi.Username = _username;
            // Set the CommandContext object. This persists state information between API requests.
            _terminalApi.CommandContext = _commandContext;

            // Launch a separate thread to print a loading message while waiting for the terminal API to execute commands.
            var loadingThread = new Thread(ShowLoading);
            loadingThread.Start();

            // Pass command string to the terminal API. No pre-parsing necessary, just pass the string.
            var commandResult = _terminalApi.ExecuteCommand(commandString);

            // Stop the loading message thread when API returns.
            loadingThread.Abort();
            loadingThread.Join();

            // Pass result object to special method that will determine how to display the results.
            InterpretResult(commandResult);
        }
 public ApiController(TerminalApi terminalApi, IDataBucket dataBucket, UIContext uiContext)
 {
     _terminalApi = terminalApi;
     _dataBucket = dataBucket;
     _uiContext = uiContext;
 }