当前位置: 首页>>代码示例>>C#>>正文


C# IPlugin.Execute方法代码示例

本文整理汇总了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;
        }
开发者ID:camalot,项目名称:droidexplorer,代码行数:30,代码来源:PluginHelper.cs

示例2: RunPlugin

 private void RunPlugin(IPlugin plugin)
 {
     plugin.Execute();
 }
开发者ID:prototype464,项目名称:Terraria-Map-Editor,代码行数:4,代码来源:WorldViewModel.Commands.cs

示例3: ExecutePluginCommandExecuted

 /// <summary>
 /// Executes a plugins command.
 /// </summary>
 /// <param name="plugin">Plugin</param>
 private void ExecutePluginCommandExecuted(IPlugin plugin)
 {
     plugin.Execute(this.ModelData);
 }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:8,代码来源:ModelContextViewModel.cs

示例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;
        }
开发者ID:NAVERTICA,项目名称:SPTools,代码行数:91,代码来源:PluginHost.cs


注:本文中的IPlugin.Execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。