/// <summary>
        /// Constructor
        /// </summary>
        public AvalonTerminal() : base()
        {
            // Disable the undo stack, we don't need it.
            this.Document.UndoStack.SizeLimit = 0;

            // Set our custom properties
            this.TextArea.TextView.Options.EnableEmailHyperlinks       = false;
            this.TextArea.TextView.Options.EnableHyperlinks            = false;
            this.TextArea.TextView.Options.ShowBoxForControlCharacters = false;
            this.TextArea.Caret.CaretBrush = Brushes.Transparent;

            // Setup our custom line and element transformers.
            this.TextArea.TextView.ElementGenerators.Add(new HideAnsiElementGenerator(this)
            {
                ParseExtended = false
            });
            this.TextArea.TextView.LineTransformers.Add(new AnsiColorizer());

            this.Gag = new GagElementGenerator();
            this.TextArea.TextView.ElementGenerators.Add(this.Gag);

            // For custom key handling like trapping copy and paste.
            this.PreviewKeyDown += OnPreviewKeyDown;

            // To handle code for when the size of the control changes (namingly, the width).
            this.SizeChanged += this.AvalonTerminal_SizeChanged;

            // Find out if we're wrapped.
            this.TextArea.TextView.VisualLinesChanged += this.TextView_VisualLinesChanged;

            // When the control is unloaded we'll unwind anything that needs cleaned up like event handlers.
            this.Unloaded += AvalonTerminal_Unloaded;
        }
Esempio n. 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public AvalonTerminal() : base()
        {
            // Disable the undo stack, we don't need it.
            this.Document.UndoStack.SizeLimit = 0;

            // Set our custom properties
            this.TextArea.TextView.Options.EnableEmailHyperlinks       = false;
            this.TextArea.TextView.Options.EnableHyperlinks            = false;
            this.TextArea.TextView.Options.ShowBoxForControlCharacters = false;
            this.TextArea.Caret.CaretBrush = Brushes.Transparent;

            // Setup our custom line and element transformers.
            this.TextArea.TextView.LineTransformers.Add(new AnsiColorizer());

            _gagElementGenerator = new GagElementGenerator();
            this.TextArea.TextView.ElementGenerators.Add(_gagElementGenerator);

            // For custom key handling like trapping copy and paste.
            this.PreviewKeyDown += OnPreviewKeyDown;
        }