projectactiveevaluator.cs
来自「SharpDevelop2.0.0 c#开发免费工具」· CS 代码 · 共 48 行
CS
48 行
// <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.Collections;
using System.Xml;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.Core
{
/// <summary>
/// Tests if any project is active or if a project of a specific language is active.
/// </summary>
/// <attribute name="activeproject">
/// The language name the project should have.
/// "*" to test if any project is active.
/// </attribute>
/// <example title="Test if any project is active">
/// <Condition name = "ProjectActive" activeproject="*">
/// </example>
/// <example title="Test if a C# project is active">
/// <Condition name = "ProjectActive" activeproject="C#">
/// </example>
public class ProjectActiveConditionEvaluator : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)
{
string activeproject = condition.Properties["activeproject"];
IProject project = ProjectService.CurrentProject;
if (activeproject == "*") {
return project != null;
}
return project != null && project.Language == activeproject;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?