示例#1
0
        void CompilePalLogger_OnError(string errorText, Error e)
        {
            Dispatcher.Invoke(() =>
            {
                Hyperlink errorLink = new Hyperlink();

                Run text = new Run(errorText);

                text.Foreground = e.ErrorColor;

                errorLink.Inlines.Add(text);
                errorLink.TargetName = e.ID.ToString();
                errorLink.Click     += errorLink_Click;

                var underline = new TextDecoration
                {
                    Location         = TextDecorationLocation.Underline,
                    Pen              = new Pen(e.ErrorColor, 1),
                    PenThicknessUnit = TextDecorationUnit.FontRecommended
                };

                errorLink.TextDecorations = new TextDecorationCollection(new[] { underline });

                OutputParagraph.Inlines.Add(errorLink);
                CompileOutputTextbox.ScrollToEnd();
            });
        }
示例#2
0
        Run Logger_OnWrite(string s, Brush b = null)
        {
            return(Dispatcher.Invoke(() =>
            {
                if (string.IsNullOrEmpty(s))
                {
                    return null;
                }

                Run textRun = new Run(s);

                if (b != null)
                {
                    textRun.Foreground = b;
                }

                OutputParagraph.Inlines.Add(textRun);

                // scroll to end only if already scrolled to the bottom. 1.0 is an epsilon value for double comparison
                if (CompileOutputTextbox.VerticalOffset + CompileOutputTextbox.ViewportHeight >= CompileOutputTextbox.ExtentHeight - 1.0)
                {
                    CompileOutputTextbox.ScrollToEnd();
                }

                return textRun;
            }));
        }
示例#3
0
        void CompilePalLogger_OnError(string errorText, Error e)
        {
            Dispatcher.Invoke(() =>
            {
                Hyperlink errorLink = new Hyperlink();

                Run text = new Run(errorText);

                text.Foreground = e.ErrorColor;

                errorLink.Inlines.Add(text);
                errorLink.TargetName = e.ID.ToString();
                errorLink.Click     += errorLink_Click;

                if (CompileOutputTextbox.Document.Blocks.Any())
                {
                    var lastPara = (Paragraph)CompileOutputTextbox.Document.Blocks.LastBlock;
                    lastPara.Inlines.Add(errorLink);
                }
                else
                {
                    var newPara = new Paragraph(errorLink);
                    CompileOutputTextbox.Document.Blocks.Add(newPara);
                }

                CompileOutputTextbox.ScrollToEnd();
            });
        }
示例#4
0
        void Logger_OnWrite(string s, Brush b = null)
        {
            Dispatcher.Invoke(() =>
            {
                if (string.IsNullOrEmpty(s))
                {
                    return;
                }

                //OutputTab.Focus();

                if (b != null)
                {
                    TextRange tr = new TextRange(CompileOutputTextbox.Document.ContentEnd,
                                                 CompileOutputTextbox.Document.ContentEnd)
                    {
                        Text = s
                    };
                    tr.ApplyPropertyValue(TextElement.ForegroundProperty, b);
                }
                else
                {
                    CompileOutputTextbox.AppendText(s);
                }

                CompileOutputTextbox.ScrollToEnd();
            });
        }
示例#5
0
 void CompilingManager_OnClear()
 {
     Dispatcher.Invoke(() =>
     {
         CompileOutputTextbox.Document.Blocks.Clear();
         CompileOutputTextbox.AppendText(Environment.NewLine);
     });
 }
示例#6
0
        Run Logger_OnWrite(string s, Brush b = null)
        {
            return(Dispatcher.Invoke(() =>
            {
                if (string.IsNullOrEmpty(s))
                {
                    return null;
                }

                Run textRun = new Run(s);

                if (b != null)
                {
                    textRun.Foreground = b;
                }

                OutputParagraph.Inlines.Add(textRun);

                CompileOutputTextbox.ScrollToEnd();
                return textRun;
            }));
        }