Пример #1
0
        private static FormattedText FormatStatements(string tipText, BlockColoring coloring, TextRunProperties properties)
        {
            FormattedText formattedText = new FormattedText(tipText,
                                                            CultureInfo.InvariantCulture,
                                                            FlowDirection.LeftToRight,
                                                            properties.Typeface,
                                                            properties.FontRenderingEmSize,
                                                            properties.ForegroundBrush);

            if (coloring != null)
            {
                string[] loopKeywords   = new string[] { "for", "while", "do", "foreach", "For", "While", "Do", "Loop", "Until", "End While" };
                string[] ifKeywords     = new string[] { "if", "else", "switch", "If", "Else", "ElseIf", "End If" };
                string[] methodKeywords = new string[] { "private", "public", "protected", "internal", "sealed", "static",
                                                         "new", "override",
                                                         "int", "double", "void", "bool",
                                                         "Sub", "Function", "Module", "Class", "Property", "Get", "Set",
                                                         "Private", "Public",
                                                         "End Sub", "End Function", "End Module", "End Class", "End Property", "End Get", "End Set" };

                SetColors(coloring.GetToolTipBrush(BlockType.Loop), loopKeywords, tipText, formattedText);
                SetColors(coloring.GetToolTipBrush(BlockType.Conditional), ifKeywords, tipText, formattedText);
                SetColors(coloring.GetToolTipBrush(BlockType.Method), methodKeywords, tipText, formattedText);
            }
            return(formattedText);
        }
Пример #2
0
        private static FormattedText FormatStatements(string tipText, BlockColoring coloring, TextRunProperties properties)
        {
            FormattedText formattedText = new FormattedText(tipText, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, properties.Typeface, properties.FontRenderingEmSize, properties.ForegroundBrush);

            if (coloring != null)
            {
                string[] keywords  = new string[] { "for", "while", "foreach" };
                string[] strArray2 = new string[] { "if", "then", "else", "case", "when", "otherwise" };
                string[] strArray3 = new string[] { "function", "main", "report", "dialog" };
                SetColors(coloring.GetToolTipBrush(BlockType.Loop), keywords, tipText, formattedText);
                SetColors(coloring.GetToolTipBrush(BlockType.Conditional), strArray2, tipText, formattedText);
                SetColors(coloring.GetToolTipBrush(BlockType.Method), strArray3, tipText, formattedText);
            }
            return(formattedText);
        }