Esempio n. 1
0
        private void UpdateUiResult(string result, bool isError)
        {
            OutputArea.Text = result;

            IThemedHighlightingManager hm = ThemedHighlightingManager.Instance;

            hm.SetCurrentTheme("VS2019_Dark");
            if (isError)
            {
                OutputArea.SyntaxHighlighting = hm.GetDefinitionByExtension(".txt");
            }
            else
            {
                OutputArea.SyntaxHighlighting = hm.GetDefinitionByExtension(".grazor");
            }


            if (!isError && settings.OpenFile)
            {
                string savedFilePath = Serializer.SaveTemporaryFile(result);
                System.Diagnostics.Process.Start(savedFilePath);
            }

            isLoading  = false;
            hasChanged = false;
            LoadingOverlay.Visibility = Visibility.Collapsed;
            oldText = result;
        }
        public ChangeLogPage()
        {
            InitializeComponent();

            IThemedHighlightingManager hm = ThemedHighlightingManager.Instance;

            hm.SetCurrentTheme("VS2019_Dark");
            AdditionalDataField.SyntaxHighlighting = hm.GetDefinitionByExtension(".js");
        }
        public VersionPage()
        {
            InitializeComponent();

            redColor   = new SolidColorBrush(Color.FromRgb(255, 0, 0));
            whiteColor = new SolidColorBrush(Color.FromRgb(255, 255, 255));

            IThemedHighlightingManager hm = ThemedHighlightingManager.Instance;

            hm.SetCurrentTheme("VS2019_Dark");
            AdditionalDataField.SyntaxHighlighting = hm.GetDefinitionByExtension(".js");
        }
        private static void SetAvalonTheme(bool isDark)
        {
            IThemedHighlightingManager hm = ThemedHighlightingManager.Instance;

            hm.SetCurrentTheme(isDark ? "VS2019_Dark" : "Light");
            MainWindow window = (MainWindow)Application.Current.MainWindow;

            window.textEditor.SyntaxHighlighting          = hm.GetDefinitionByExtension(".js");
            window.textEditor.Background                  = new SolidColorBrush(isDark ? Color.FromRgb(30, 30, 30) : Color.FromRgb(255, 255, 255));
            window.textEditor.Foreground                  = new SolidColorBrush(isDark ? Color.FromRgb(255, 255, 255) : Color.FromRgb(0, 0, 0));
            window.textEditor.LineNumbersForeground       = new SolidColorBrush(isDark ? Color.FromRgb(190, 190, 190) : Color.FromRgb(60, 60, 60));
            window.textEditor.EditorCurrentLineBackground = new SolidColorBrush(isDark ? Color.FromRgb(37, 37, 37) : Color.FromRgb(245, 245, 245));
        }
Esempio n. 5
0
        public MainWindow()
        {
            InitializeComponent();
            settings = Serializer.GetSettings();
            if (settings.FontSize < 1)
            {
                settings.FontSize = 20;
            }

            IThemedHighlightingManager hm = ThemedHighlightingManager.Instance;

            hm.SetCurrentTheme("VS2019_Dark");
            InputArea.SyntaxHighlighting  = hm.GetDefinitionByExtension(".grazor");
            OutputArea.SyntaxHighlighting = hm.GetDefinitionByExtension(".grazor");

            InputArea.FontSize  = settings.FontSize;
            OutputArea.FontSize = settings.FontSize;

            if (!settings.LineNumbers)
            {
                InputArea.ShowLineNumbers  = false;
                OutputArea.ShowLineNumbers = false;
            }
            else
            {
                InputArea.Loaded  += (object send, RoutedEventArgs e) => SetLineNumberMargin(InputArea);
                OutputArea.Loaded += (object send, RoutedEventArgs e) => SetLineNumberMargin(OutputArea);
            }

            InputArea.WordWrap  = settings.WordWrap;
            OutputArea.WordWrap = settings.WordWrap;

            InputArea.Loaded  += (object send, RoutedEventArgs e) => SetContextMenuIcons(InputArea);
            OutputArea.Loaded += (object send, RoutedEventArgs e) => SetContextMenuIcons(OutputArea);

            var heightDescriptor = DependencyPropertyDescriptor.FromProperty(RowDefinition.HeightProperty, typeof(ItemsControl));

            heightDescriptor.AddValueChanged(TopRow, SplitterHeightChanged);

            BuildExample(Serializer.GetExamples());
        }
Esempio n. 6
0
        public ExCode(CodeControlModel codeModel, Settings appSettings)
        {
            InitializeComponent();
            model    = codeModel;
            settings = appSettings;
            if (settings.FontSize < 1)
            {
                settings.FontSize = 20;
            }

            Parent.Margin = new Thickness(0, model.MarginAbove, 0, model.MarginBelow);

            whiteBrush = new SolidColorBrush(Color.FromRgb(255, 255, 255));
            greenBrush = new SolidColorBrush(Color.FromRgb(129, 237, 104));

            CodeEditor.Loaded  += (object send, RoutedEventArgs e) => EditorLoadedEvent();
            CodeEditor.WordWrap = settings.WordWrap;

            // Set text area fields content type to use JSON (js) highlighting
            IThemedHighlightingManager hm = ThemedHighlightingManager.Instance;

            hm.SetCurrentTheme("VS2019_Dark");
            CodeEditor.SyntaxHighlighting = hm.GetDefinitionByExtension(".grazor");
        }