#pragma warning disable CS8618 // Non-nullable field is uninitialized. public FileEditor(ISettingsManager settings, IUIServices uIServices) #pragma warning restore CS8618 // Non-nullable field is uninitialized. { InitializeComponent(); _settings = settings; _uIServices = uIServices; SyntaxHighlightingHelper.RegisterHightingExtensions(); // set the Syntax Highlighting definitions SyntaxDefinitions.ItemsSource = HighlightingManager.Instance.HighlightingDefinitions; // Set the initial Font Family to Consolas FontChoice.ItemsSource = Fonts.SystemFontFamilies.OrderBy(p => p.Source); FontChoice.SelectedItem = ConsolasFont; // disable unnecessary editor features Editor.Options.CutCopyWholeLine = false; Editor.Options.EnableEmailHyperlinks = false; Editor.Options.EnableHyperlinks = false; Editor.Options.ConvertTabsToSpaces = true; Editor.TextArea.SelectionCornerRadius = 0; var searchInput = SearchPanel.Install(Editor.TextArea); }
public FileEditor() { InitializeComponent(); SyntaxHighlightingHelper.RegisterHightingExtensions(); // set the Syntax Highlighting definitions SyntaxDefinitions.ItemsSource = HighlightingManager.Instance.HighlightingDefinitions; // Set the initial Font Family to Consolas FontChoice.ItemsSource = Fonts.SystemFontFamilies.OrderBy(p => p.Source); FontChoice.SelectedItem = ConsolasFont; // disable unnecessary editor features Editor.Options.CutCopyWholeLine = false; Editor.Options.EnableEmailHyperlinks = false; Editor.Options.EnableHyperlinks = false; Editor.Options.ConvertTabsToSpaces = true; Editor.TextArea.SelectionCornerRadius = 0; var searchInput = new SearchInputHandler(Editor.TextArea); Editor.TextArea.DefaultInputHandler.NestedInputHandlers.Add(searchInput); }
private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if (e.NewValue is FileEditorViewModel viewModel && viewModel.FileInEdit != null) { SyntaxDefinitions.SelectedItem = SyntaxHighlightingHelper.GuessHighligtingDefinition(viewModel.FileInEdit.Path); Editor.Load(viewModel.FileInEdit.GetStream()); } }
private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { var info = (FileContentInfo)DataContext; if (info != null && info.IsTextFile) { LanguageBox.SelectedItem = SyntaxHighlightingHelper.GuessHighligtingDefinition(info.File.Name); contentBox.ScrollToHome(); contentBox.Load(StreamUtility.ToStream((string)info.Content)); } else { contentBox.Clear(); } }
private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if (e.NewValue is FileEditorViewModel viewModel && viewModel.FileInEdit != null) { SyntaxDefinitions.SelectedItem = SyntaxHighlightingHelper.GuessHighligtingDefinition(viewModel.FileInEdit.Path); try { var stream = viewModel.FileInEdit.GetStream(); stream = StreamUtility.MakeSeekable(stream); Editor.Load(stream); } catch (Exception ex) { _uIServices.Show(ex.Message, MessageLevel.Error); } } }
#pragma warning disable CS8618 // Non-nullable field is uninitialized. public ContentViewerPane() #pragma warning restore CS8618 // Non-nullable field is uninitialized. { InitializeComponent(); SyntaxHighlightingHelper.RegisterHightingExtensions(); // set the Syntax Highlighting definitions LanguageBox.ItemsSource = HighlightingManager.Instance.HighlightingDefinitions; // disable unnecessary editor features contentBox.Options.CutCopyWholeLine = false; contentBox.Options.EnableEmailHyperlinks = false; contentBox.Options.EnableHyperlinks = false; contentBox.TextArea.SelectionCornerRadius = 0; _searchPanel = SearchPanel.Install(contentBox.TextArea); }
private async void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if (e.NewValue is FileEditorViewModel viewModel && viewModel.FileInEdit != null) { SyntaxDefinitions.SelectedItem = SyntaxHighlightingHelper.GuessHighligtingDefinition(viewModel.FileInEdit.Path); var stream = viewModel.FileInEdit.GetStream(); if (!stream.CanSeek) { var memoryStream = new MemoryStream(); using (stream) { await stream.CopyToAsync(memoryStream); } memoryStream.Position = 0; stream = memoryStream; } Editor.Load(stream); } }
public ContentViewerPane() { InitializeComponent(); SyntaxHighlightingHelper.RegisterHightingExtensions(); // set the Syntax Highlighting definitions LanguageBox.ItemsSource = HighlightingManager.Instance.HighlightingDefinitions; // disable unnecessary editor features contentBox.Options.CutCopyWholeLine = false; contentBox.Options.EnableEmailHyperlinks = false; contentBox.Options.EnableHyperlinks = false; contentBox.TextArea.SelectionCornerRadius = 0; var searchInput = new SearchInputHandler(contentBox.TextArea); _findCommand = searchInput.CommandBindings.FirstOrDefault(binding => binding.Command == ApplicationCommands.Find); contentBox.TextArea.DefaultInputHandler.NestedInputHandlers.Add(searchInput); }