当前位置: 首页>>代码示例>>C#>>正文


C# TextEditor.Load方法代码示例

本文整理汇总了C#中ICSharpCode.AvalonEdit.TextEditor.Load方法的典型用法代码示例。如果您正苦于以下问题:C# TextEditor.Load方法的具体用法?C# TextEditor.Load怎么用?C# TextEditor.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICSharpCode.AvalonEdit.TextEditor的用法示例。


在下文中一共展示了TextEditor.Load方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ScarEditorControl

        public ScarEditorControl(UniFile file)
        {
            InitializeComponent();
            m_btnSave.Click += BtnSaveClick;

            m_file = file;

            m_editor = new TextEditor();
            m_wpfTextEditor.Child = m_editor;

            m_editor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("LUA Highlighting");
            m_editor.ShowLineNumbers = true;
            m_editor.TextChanged += EditorTextChanged;
            m_editor.Load(file.Stream);
        }
开发者ID:micheleissa,项目名称:dow2-toolbox,代码行数:15,代码来源:ScarEditorControl.cs

示例2: CreateTab

        private DocumentInfo CreateTab(string fullPath, string title)
        {
            TextEditor editor = new TextEditor();
            editor.FontFamily = new FontFamily("Consolas");
            editor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");
            editor.ShowLineNumbers = true;
            if (!string.IsNullOrWhiteSpace(fullPath))
            {
                editor.Load(fullPath);
            }

            LayoutDocument document = new LayoutDocument();
            document.Title = title;
            document.Content = editor;
            document.Closing += document_Closing;

            _window.DocumentPane.InsertChildAt(_window.DocumentPane.ChildrenCount, document);
            document.IsSelected = true;

            DocumentInfo info = new DocumentInfo(fullPath, title, document, editor);
            _documents[info.ID] = info;

            document.ContentId = info.ID.ToString();

            return info;
        }
开发者ID:wupeng78,项目名称:QuIDE-source-code,代码行数:26,代码来源:HomeVM.cs

示例3: Tab

        public Tab(string path)
        {
            // arrange
            matchingTokensBackground = Theme.Instance.MatchingTokensBackground.ToColor();

            #region Set Name and DocumentPath

            if (path.IsBlank())
            {
                IsSaved = false;
                Name = "new";
                DocumentPath = string.Empty;
            }
            else
            {
                if (!File.Exists(path))
                {
                    // Notifier.Show("Attempted to open a file that doesn't exist");
                    return;
                }

                IsSaved = true;
                Name = Path.GetFileName(path);
                DocumentPath = path;
            }

            #endregion

            #region Create editor

            Editor = new TextEditor();
            Editor.FontSize = 13;
            Editor.ShowLineNumbers = true;
            Editor.Options.EnableEmailHyperlinks = false;
            Editor.Options.EnableHyperlinks = false;
            Editor.Options.ShowBoxForControlCharacters = true;
            //Editor.Options.ConvertTabsToSpaces = true;
            Editor.Background = ThemeColorConverter.GetColor("Background");
            Editor.Foreground = ThemeColorConverter.GetColor("Foreground");
            Editor.FontFamily = new FontFamily(Theme.Instance.FontFamily);
            Editor.TextArea.PreviewKeyDown += EditorKeyDown;
            Editor.TextChanged += TextChanged;
            Editor.TextArea.SelectionChanged += SelectionChanged;
            Editor.TextArea.Caret.PositionChanged += CaretOffsetChanged;
            Editor.TextArea.GotFocus += EditorGotFocus;
            Editor.Encoding = System.Text.Encoding.GetEncoding("ASCII");

            #endregion

            #region Create context menu for editor

            var menu = new ContextMenu();

            menu.Items.Add(ContextMenuHelper.CreateManuItem("New Tab", "CTRL+T", () => Controller.Current.CreateNewTab("")));
            menu.Items.Add(ContextMenuHelper.CreateManuItem("Open Previous Tab", "CTRL+SHIFT+T", Controller.Current.OpenLastClosedTab));
            menu.Items.Add(ContextMenuHelper.CreateManuItem("Browse File", "CTRL+O", Controller.Current.BrowseFile));
            menu.Items.Add(new Separator());
            menu.Items.Add(ContextMenuHelper.CreateManuItem("Quick Jump", "CTRL+,", () => Controller.Current.GetWidget<Features.Projects.Widget>().Jump.ShowBox()));
            menu.Items.Add(ContextMenuHelper.CreateManuItem("Stats & Encoding", "CTRL+ALT (hold)", () => Controller.Current.GetWidget<Features.Stats.Widget>().ShowStats()));
            menu.Items.Add(new Separator());
            menu.Items.Add(GetChangleLanguageContextMenuItem());
            menu.Items.Add(ContextMenuHelper.CreateManuItem("Close Tab", "CTRL+F4", Controller.Current.CloseActiveTab));

            Editor.ContextMenu = menu;

            #endregion

            // renderer
            BlockHighlighter = new BlockHighlighter(this);
            Editor.TextArea.TextView.BackgroundRenderers.Add(BlockHighlighter);
            colorPreview = new ColorPreviewRenderer(this);
            Editor.TextArea.TextView.BackgroundRenderers.Add(colorPreview);

            // load language
            LoadLanguageHighlighterAndSyntax(null);

            // tab item
            TabHeader = new ExtendedTabHeader(this); // always before TabItem
            TabItem = new ExtendedTabItem(this);

            // assign completion window
            completionItems = new List<CompletionWindowItem>();

            // load? (always last)
            if (!path.IsBlank())
                Editor.Load(path);
        }
开发者ID:anaimi,项目名称:farawla,代码行数:87,代码来源:Tab.cs

示例4: lstFile_MouseRightButtonUp

        private void lstFile_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
        {
            TextBlock item = lstFiles.SelectedItem as TextBlock;
            string file = item.Text;

            var documentContent = new AvalonDock.DocumentContent();
            documentContent.Title = file;
            
            ICSharpCode.AvalonEdit.TextEditor newEditor = new ICSharpCode.AvalonEdit.TextEditor();
            newEditor.ShowLineNumbers = txtCode.ShowLineNumbers;
            newEditor.WordWrap = txtCode.WordWrap;
            newEditor.SyntaxHighlighting = txtCode.SyntaxHighlighting;
            newEditor.Background = Brushes.LightGray;
            newEditor.Load(Helper.GetCurrentWorkingDir() + "\\" + file + ".tex");
            newEditor.IsReadOnly = true;

            documentContent.Content = newEditor;
            documentContent.Show(dockManager);
            //select the just added document
            if(dockManager.ActiveDocument != null)
                dockManager.ActiveDocument.ContainerPane.SelectedIndex = 0;
        }
开发者ID:JoeyEremondi,项目名称:tikzedt,代码行数:22,代码来源:MainWindow.xaml+-+with+avalondock.cs


注:本文中的ICSharpCode.AvalonEdit.TextEditor.Load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。