本文整理汇总了C#中IPlugin.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# IPlugin.Execute方法的具体用法?C# IPlugin.Execute怎么用?C# IPlugin.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlugin
的用法示例。
在下文中一共展示了IPlugin.Execute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateToolStripButtonForPlugin
/// <summary>
/// Creates the tool strip button for plugin.
/// </summary>
/// <param name="plugin">The plugin.</param>
/// <returns></returns>
public static ToolStripButton CreateToolStripButtonForPlugin( IPlugin plugin )
{
Image img = plugin.Image == null ? DroidExplorer.Resources.Images.android : plugin.Image;
ToolStripButton tsb = new ToolStripButton ( plugin.Text, plugin.Image, delegate ( object sender, EventArgs e ) {
try {
plugin.Execute ( plugin.PluginHost, plugin.PluginHost.CurrentDirectory );
} catch ( Exception ex ) {
//throw;
sender.LogError ( ex.Message, ex );
}
}, plugin.Name );
tsb.DisplayStyle = plugin.DisplayStyle;
// check for min tools version (there has to be a better way to check this)
var minPT = plugin.MinimumSDKPlatformToolsVersion;
var minT = plugin.MinimumSDKToolsVersion;
var sdkv = 0;
var sval = CommandRunner.Instance.GetProperty ( "ro.build.version.sdk" );
int.TryParse ( sval, out sdkv );
tsb.Enabled = sdkv >= minT;
return tsb;
}
示例2: RunPlugin
private void RunPlugin(IPlugin plugin)
{
plugin.Execute();
}
示例3: ExecutePluginCommandExecuted
/// <summary>
/// Executes a plugins command.
/// </summary>
/// <param name="plugin">Plugin</param>
private void ExecutePluginCommandExecuted(IPlugin plugin)
{
plugin.Execute(this.ModelData);
}
示例4: ValidatePlugin
//Kontrola jestli plugin obsahuje vsechny potrebne metody
//TODO - nelze ale zjisit jestli metodu obsahuje jinak nez tim ze ji vola - nepouzivame tedy
//
public static bool ValidatePlugin(IPlugin plugin)
{
List<string> missingMethods = new List<string>();
try
{
plugin.Name();
}
catch (MissingMemberException)
{
missingMethods.Add("Name");
}
try
{
plugin.Description();
}
catch (MissingMemberException)
{
missingMethods.Add("Description");
}
try
{
plugin.Version();
}
catch (MissingMemberException)
{
missingMethods.Add("Version");
}
try
{
//Tuto metodu pouzivame pouze v DLLExecute neni ji tedy nutne kontrolovatna DLR
plugin.PluginScope();
}
catch (MissingMemberException)
{
missingMethods.Add("PluginScope");
}
try
{
plugin.Execute(null, null);
}
catch (MissingMemberException)
{
missingMethods.Add("Execute");
}
catch (Exception) {}
try
{
plugin.Install(null, null);
}
catch (MissingMemberException)
{
missingMethods.Add("Install");
}
catch (Exception) { }
try
{
plugin.Test(null, null);
}
catch (MissingMemberException)
{
missingMethods.Add("Test");
}
catch (Exception) {}
try
{
plugin.GetInstance();
}
catch (Exception)
{
missingMethods.Add("GetInstance");
}
if (missingMethods.Count > 0)
{
var log = NaverticaLog.GetInstance();
log.LogError(missingMethods.Contains("Name") ? "" : plugin.Name(), "Missing methods in plugin: " + missingMethods.JoinStrings(", "));
}
return missingMethods.Count == 0;
}