Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
        static void OnTypedConsoleEntry(string command, object[] arguments)
        {
            switch (command)
            {
            case "exit":
                _console.Dispose();
                break;

            default:
                var str = new StringBuilder();
                for (int i = 0; i < arguments.Length; i++)
                {
                    if (i != 0)
                    {
                        str.Append(", ");
                    }
                    str.Append(arguments[i].GetType().Name);
                }
                _console.WriteDebug("Types", str);
                break;
            }
        }