本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}