示例#1
0
        static void TextedExample()
        {
            _console         = ConsoleForm.CreateAndRun();
            _console.OnEntry = OnConsoleEntry;
            _console.WaitForClose();
            var rnd = new Random();

            while (_console.Created)
            {
                switch (rnd.Next(0, 5))
                {
                case 0:
                    _console.WriteDebug("This is for debugging");
                    break;

                case 1:
                    _console.WriteInfo("This is some info");
                    break;

                case 2:
                    _console.WriteWarning("This is a warning");
                    break;

                case 3:
                    _console.WriteError("This is an error");
                    break;

                case 4:
                    _console.WriteException("This is an exception", new NotImplementedException());
                    break;
                }
                Thread.Sleep(2500);
            }
        }
示例#2
0
        static void OnConsoleEntry(string command, string[] arguments)
        {
            switch (command)
            {
            case "exit":
                _console.Dispose();
                break;

            default:
                _console.WriteError("Unknown command " + command + (arguments.Length == 0 ? "" : " {" + string.Join(", ", arguments) + "}"));
                break;
            }
        }