private void RenderDocument()
 {
     _codeView.Blocks.Clear();
     _formatter = new RichTextBlockFormatter();
     _formatter.FormatRichTextBlock(_displayedText, _language, _codeView);
     _rendered = true;
 }
Exemplo n.º 2
0
        public static async Task Open(string content)
        {
            var dialog    = new DumpJsonDialog(content);
            var formatter = new RichTextBlockFormatter();

            formatter.FormatRichTextBlock(content, Languages.JavaScript, dialog.TextBox_DumpContent);
            _ = await dialog.ShowAsync();
        }
Exemplo n.º 3
0
        private void RenderDocument()
        {
            if (codeView != null)
            {
                codeView.Blocks?.Clear();
                formatter = new RichTextBlockFormatter(ActualTheme);

                formatter.FormatRichTextBlock(ViewModel.TextValue, ViewModel.CodeLanguage, codeView);
            }
        }
Exemplo n.º 4
0
        private void RenderDocument()
        {
            if (_codeView != null)
            {
#if HAS_UNO
                _codeView.Text = _displayedText ?? string.Empty;
#else
                _codeView.Blocks?.Clear();
                _formatter = new RichTextBlockFormatter(_theme);

                _formatter.FormatRichTextBlock(_displayedText, _language, _codeView);
#endif
                _rendered = true;
            }
        }
Exemplo n.º 5
0
        private async void Render()
        {
            PresentationBlock.Blocks.Clear();

            var result = await GetCodeFileText();

            if (result == null)
            {
                return;
            }

            var formatter = new RichTextBlockFormatter(MainGrid.RequestedTheme);
            var plainText = formatter.Styles[ScopeName.PlainText];

            MainGrid.Background = (plainText?.Background ?? StyleDictionary.White).GetSolidColorBrush();
            formatter.FormatRichTextBlock(result.Item1, result.Item2, PresentationBlock);
        }
Exemplo n.º 6
0
        private async void PrintButton_Click(object sender, RoutedEventArgs e)
        {
            Shell.Current.DisplayWaitRing = true;

            var printblock = new RichTextBlock
            {
                FontFamily = _codeView.FontFamily
            };

            _formatter.FormatRichTextBlock(_displayedText, _language, printblock);

            _printHelper = new PrintHelper(_container);
            _printHelper.AddFrameworkElementToPrint(printblock);

            _printHelper.OnPrintFailed    += PrintHelper_OnPrintFailed;
            _printHelper.OnPrintSucceeded += PrintHelper_OnPrintSucceeded;
            _printHelper.OnPrintCanceled  += PrintHelper_OnPrintCanceled;

            await _printHelper.ShowPrintUIAsync("Windows Community Toolkit Sample App");
        }
Exemplo n.º 7
0
        private async void PrintButton_Click(object sender, RoutedEventArgs e)
        {
#if !HAS_UNO
            SampleController.Current.DisplayWaitRing = true;

            var printBlock = new RichTextBlock
            {
                FontFamily     = _codeView.FontFamily,
                RequestedTheme = ElementTheme.Light
            };
            var printFormatter = new RichTextBlockFormatter(ElementTheme.Light);
            printFormatter.FormatRichTextBlock(_displayedText, _language, printBlock);

            _printHelper = new PrintHelper(_container);
            _printHelper.AddFrameworkElementToPrint(printBlock);

            _printHelper.OnPrintFailed    += PrintHelper_OnPrintFailed;
            _printHelper.OnPrintSucceeded += PrintHelper_OnPrintSucceeded;
            _printHelper.OnPrintCanceled  += PrintHelper_OnPrintCanceled;

            await _printHelper.ShowPrintUIAsync("Windows Community Toolkit Sample App");
#endif
        }