📄 textcontentcondition.cs
字号:
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision: 915 $</version>
// </file>
using System;
using System.Xml;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.TextEditor;
namespace ICSharpCode.SharpDevelop.DefaultEditor.Conditions
{
/// <summary>
/// Tests the name of the highlighting strategy of the text editor.
/// </summary>
/// <attribute name="textcontent">
/// The name of the highlighting strategy that should be active.
/// </attribute>
/// <example title="Test if any XML file is being edited">
/// <Condition name = "TextContent" textcontent="XML">
/// </example>
public class TextContentConditionEvaluator : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)
{
string textcontent = condition.Properties["textcontent"];
if (caller is TextEditorControl) {
TextEditorControl ctrl = (TextEditorControl)caller;
if (ctrl.Document != null && ctrl.Document.HighlightingStrategy != null) {
return string.Equals(textcontent, ctrl.Document.HighlightingStrategy.Name, StringComparison.OrdinalIgnoreCase);
}
}
return false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -