Exemplo n.º 1
0
        public CSRepl()
        {
            InitializeComponent();

            textEditor = new CSReplTextEditor();
            textEditor.FontFamily = new FontFamily("Consolas");
            var convertFrom = new FontSizeConverter().ConvertFrom("10pt");
            if (convertFrom != null) textEditor.FontSize = (double)convertFrom;
            textEditor.TextArea.PreviewKeyDown += TextAreaOnPreviewKeyDown;
            textEditor.IsEnabled = false;
            textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");
            textEditor.FileName = "repl.csx";
            textEditor.Repl = this;
            this.Content = textEditor;

            commandHistory = new CommandHistory();

            ShowConsoleOutput = true;
            OutputColor = Color.FromArgb(255, 78, 78, 78);
            WarningColor = Color.FromArgb(255, 183, 122, 0);
            ErrorColor = Color.FromArgb(255, 138, 6, 3);
            ReplColor = Color.FromArgb(255, 0, 127, 0);

            //supress duplicate using warnings
            SuppressWarning("CS0105");

            //clears the console and prints the headers
            // when clearing the initial transormers are removed too but we want to keep them
            initialTransformers = textEditor.TextArea.TextView.LineTransformers.ToArray();
            Clear();
        }
Exemplo n.º 2
0
        public CSRepl()
        {
            InitializeComponent();

            textEditor = new CSReplTextEditor();
            textEditor.FontFamily = new FontFamily("Consolas");
            var convertFrom = new FontSizeConverter().ConvertFrom("10pt");
            if (convertFrom != null) textEditor.FontSize = (double)convertFrom;
            textEditor.TextArea.PreviewKeyDown += TextAreaOnPreviewKeyDown;
            textEditor.IsEnabled = false;
            textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");
            textEditor.FileName = "repl.csx";
            textEditor.Repl = this;
            this.Content = textEditor;

            commandHistory = new CommandHistory();

            var errorStream = new ConsoleStream(TextType.Error, Write);
            var errorWriter = new StreamWriter(errorStream);
            errorWriter.AutoFlush = true;
            Console.SetError(errorWriter);

            var stdoutStream = new ConsoleStream(TextType.Output, Write);
            var stdoutWriter = new StreamWriter(stdoutStream);
            stdoutWriter.AutoFlush = true;
            Console.SetOut(stdoutWriter);

            ShowConsoleOutput = true;
            ResetColor();

            //supress duplicate using warnings
            SuppressWarning("CS0105");

            //clears the console and prints the headers
            // when clearing the initial transormers are removed too but we want to keep them
            initialTransformers = textEditor.TextArea.TextView.LineTransformers.ToArray();
            Clear();
        }