Пример #1
0
 protected ShellApplication()
 {
     output = new ConsoleOutputDevice(System.Console.Out, true);
     message = new ConsoleOutputDevice(System.Console.Error, false);
     input = new ConsoleInputDevice();
     dispatcher = new CommandDispatcher(this);
     if (this is ISettingsHandler)
         settings = new ApplicationSettings(this);
     if (this is IPropertyHandler)
         properties = new PropertyRegistry(this as IPropertyHandler);
     if (this is IPluginHandler)
         plugins = new ApplicationPlugins(this);
     interruptHandler = new ApplicationInterruptionHandler(this);
 }
Пример #2
0
        public void SetPrompt(string text)
        {
            prompt = text;
            //			StringBuilder tmp = new StringBuilder();
            //			int emptyLength = prompt.Length;
            //			for (int i = emptyLength; i > 0; --i) {
            //				tmp.Append(' ');
            //			}
            //			emptyPrompt = tmp.ToString();

            if (output == null)
                output = new ConsoleOutputDevice(System.Console.Out, true);
            if (message == null)
                message = new ConsoleOutputDevice(System.Console.Error, false);
            if (input == null)
                input = new ConsoleInputDevice();

            if (output is ConsoleOutputDevice)
                (output as ConsoleOutputDevice).Prompt = prompt;
            if (input is ConsoleInputDevice)
                (input as ConsoleInputDevice).Prompt = prompt;
        }
Пример #3
0
        public void SetInputDevice(InputDevice device)
        {
            if (device == null)
                throw new ArgumentNullException("device");

            input = device;
        }