textcontentcondition.cs
来自「SharpDevelop2.0.0 c#开发免费工具」· CS 代码 · 共 43 行
CS
43 行
// <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 + =
减小字号Ctrl + -
显示快捷键?