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


C# PluginManager类代码示例

本文整理汇总了C#中PluginManager的典型用法代码示例。如果您正苦于以下问题:C# PluginManager类的具体用法?C# PluginManager怎么用?C# PluginManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PluginManager类属于命名空间,在下文中一共展示了PluginManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PluginManagerDialog

            public PluginManagerDialog(Window parent,
						    PluginManager
						    manager)
                : base(Catalog.GetString("Plugins"),
								   parent,
								   DialogFlags.
								   Modal,
								   Catalog.GetString("Close"),
								   ResponseType.
								   None)
            {
                SetupTree ();
                foreach (PluginInfo info in manager.Plugins)
                {
                    if (info.Plugin == null)
                      {
                          continue;
                      }
                    store.AppendValues (info);
                }

                ScrolledWindow win = new ScrolledWindow ();
                  win.HscrollbarPolicy = PolicyType.Automatic;
                  win.VscrollbarPolicy = PolicyType.Automatic;
                  win.Child = tree;
                  VBox.PackStart (win, true, true, 4);
                  SetSizeRequest (400, 400);
                  VBox.ShowAll ();
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:29,代码来源:PluginManagerDialog.cs

示例2: Main

        static void Main(string[] args)
        {
            #region Discover succeed due to a compatible version

            Console.WriteLine("Discover all ISamplePlugin plugins with version > 1.0 and version < 1.9.3 ...");

            var pm = new PluginManager(Environment.CurrentDirectory + System.IO.Path.DirectorySeparatorChar + "SamplePlugin")
                .Register<ISamplePlugin.ISamplePlugin>(new Version(1, 0), new Version(1, 9, 3))
                    .Discover();

            var plugin = pm.GetPlugins<ISamplePlugin.ISamplePlugin>(p => p.GetType().Name == "SamplePlugin").FirstOrDefault();
            Console.WriteLine("Succeeded for: " + plugin.SampleMethod(1, ""));

            #endregion

            #region Discovering fail due to an incompatible version

            Console.WriteLine("");
            Console.WriteLine("Discover all ISamplePlugin plugins with version > 1.0 and version < 1.8 ...");

            pm = new PluginManager(Environment.CurrentDirectory + System.IO.Path.DirectorySeparatorChar + "SamplePlugin")
                .Register<ISamplePlugin.ISamplePlugin>(new Version(1, 0), new Version(1, 8));

            pm.OnPluginIncompatibleVersion += (sender, e) =>
            {
                Console.WriteLine("Failed: [{0}] is not between [{1}] and [{2}]", e.PluginVersion, e.MinVersion, e.MaxVersion);
            };
            pm.Discover(false); // do not throw an axception

            #endregion

            Console.ReadKey();
        }
开发者ID:sones,项目名称:VersionedPluginManager,代码行数:33,代码来源:Program.cs

示例3: Initialize

        public override void Initialize()
        {
            // required so we can access property.Value
            //PropertyValueConvertersResolver.Current = new PropertyValueConvertersResolver();

            base.Initialize();

            // this is so the model factory looks into the test assembly
            _pluginManager = PluginManager.Current;
            PluginManager.Current = new PluginManager(false)
            {
                AssembliesToScan = _pluginManager.AssembliesToScan
                    .Union(new[] { typeof(PublishedContentTests).Assembly })
            };

            ApplicationContext.Current = new ApplicationContext(false) { IsReady = true };

            // need to specify a custom callback for unit tests
            // AutoPublishedContentTypes generates properties automatically
            // when they are requested, but we must declare those that we
            // explicitely want to be here...

            var propertyTypes = new[]
                {
                    // AutoPublishedContentType will auto-generate other properties
                    new PublishedPropertyType("umbracoNaviHide", 0, Guid.Parse(Constants.PropertyEditors.TrueFalse)), 
                    new PublishedPropertyType("selectedNodes", 0, Guid.Empty), 
                    new PublishedPropertyType("umbracoUrlAlias", 0, Guid.Empty), 
                    new PublishedPropertyType("content", 0, Guid.Parse(Constants.PropertyEditors.TinyMCEv3)), 
                    new PublishedPropertyType("testRecursive", 0, Guid.Empty), 
                };
            var type = new AutoPublishedContentType(0, "anything", propertyTypes);
            PublishedContentType.GetPublishedContentTypeCallback = (alias) => type;
        }
开发者ID:saciervo,项目名称:Umbraco-CMS,代码行数:34,代码来源:PublishedContentTests.cs

示例4: Initialize

        internal static void Initialize()
        {
            if (mGlobalInstance == null)
            {
                mGlobalInstance = new PluginManager(true);
                mGlobalInstance.LoadPlugins(@"GlueView\Plugins");
            }

            if (mProjectInstance != null)
            {
                foreach (IPlugin plugin in ((PluginManager)mProjectInstance).mPluginContainers.Keys)
                {
                    ShutDownPlugin(plugin, PluginShutDownReason.GlueShutDown);
                }
            }

            mProjectInstance = new PluginManager(false);

            mInstances.Clear();
            mInstances.Add(mGlobalInstance);
            mInstances.Add(mProjectInstance);

            GluxManager.BeforeVariableSet += OnBeforeVariableSet;
            GluxManager.AfterVariableSet += OnAfterVariableSet;

            mProjectInstance.LoadPlugins(@"GlueView\Plugins");
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:27,代码来源:PluginManager.cs

示例5: Main

        public static void Main(string[] args)
        {
            TabsterEnvironment.CreateDirectories();

            // prepare logging
            var logDirectory = TabsterEnvironment.CreateEnvironmentDirectoryPath(TabsterEnvironmentDirectory.ApplicatonData, "Logs");
            Logging.SetLogDirectory(logDirectory);

            // log all the errors
            AppDomain.CurrentDomain.UnhandledException += (s, e) =>
            {
                var ex = (Exception) e.ExceptionObject;
                Logging.GetLogger().Error(ex);
            };

            _pluginManager = new PluginManager(TabsterEnvironment.CreateEnvironmentDirectoryPath(TabsterEnvironmentDirectory.ApplicatonData, "Plugins"));

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var assemblyGuid = ((GuidAttribute) Assembly.GetExecutingAssembly().GetCustomAttributes(typeof (GuidAttribute), true)[0]).Value;
            var filename = Path.Combine(TabsterEnvironment.GetEnvironmentDirectoryPath(TabsterEnvironmentDirectory.ApplicatonData), string.Format("{0}.tmp", assemblyGuid));

            using (var instanceController = new TabsterSingleInstanceController(filename))
            {
                instanceController.Start(new ReadOnlyCollection<string>(args));
            }
        }
开发者ID:GetTabster,项目名称:Tabster,代码行数:28,代码来源:Program.cs

示例6: MessagePump

 public MessagePump(PluginManager plugins, ArrayList connections)
 {
     this._run = false;
     this._plugins = plugins;
     this.set_processors();
     this._connections = connections;
     this._run_lock = new object();
 }
开发者ID:spox,项目名称:irisim,代码行数:8,代码来源:MessagePump.cs

示例7: LoadValidDataReaderPlugin

 public void LoadValidDataReaderPlugin()
 {
     using (var pluginManager = new PluginManager(_pluginsDirectory))
     {
         pluginManager.DeployPluginAsync(_pluginAssemblyPath).Wait();
         Assert.AreEqual(1, pluginManager.Plugins.Count());
     }
 }
开发者ID:olegkotovich,项目名称:Test,代码行数:8,代码来源:PlugunManagerTests.cs

示例8: Load_WhenThePluginExists_ReturnPluginInstance

        public void Load_WhenThePluginExists_ReturnPluginInstance()
        {
            var pluginManager = new PluginManager(_addInRootPath);

            ICalculatorPlugin calculatorPlugin = pluginManager.Load<ICalculatorPlugin>();

            Assert.NotNull(calculatorPlugin);
        }
开发者ID:RamanBut-Husaim,项目名称:.NET-Practice,代码行数:8,代码来源:PluginManagerTests.cs

示例9: Load_WhenTheTypeIsSpecified_ItIsLoaded

        public void Load_WhenTheTypeIsSpecified_ItIsLoaded()
        {
            var pluginManager = new PluginManager(AppDomain.CurrentDomain.BaseDirectory);

            FakeCalculatorPlugin fakePlugin = pluginManager.Load<FakeCalculatorPlugin>();

            Assert.NotNull(fakePlugin);
        }
开发者ID:RamanBut-Husaim,项目名称:.NET-Practice,代码行数:8,代码来源:PluginManagerTests.cs

示例10: IsLoaded_WhenPluginIsLoaded_ReturnsTrue

        public void IsLoaded_WhenPluginIsLoaded_ReturnsTrue()
        {
            var pluginManager = new PluginManager(_addInRootPath);

            ICalculatorPlugin calculatorPlugin = pluginManager.Load<ICalculatorPlugin>();

            Assert.True(pluginManager.IsLoaded<ICalculatorPlugin>());
        }
开发者ID:RamanBut-Husaim,项目名称:.NET-Practice,代码行数:8,代码来源:PluginManagerTests.cs

示例11: ContextMenuBuilder

        /// <summary>
        /// Initializes a new instance of the <see cref="ContextMenuBuilder"/> class.
        /// </summary>
        /// <param name="pluginManager">The plugin manager. This can be found on MainWindow.</param>
        /// <param name="mainWindow">The main window command interface. This can be found on mainwindow.</param>
        public ContextMenuBuilder(PluginManager pluginManager, IMainWindow mainWindow)
        {
            Util.ThrowIfParameterNull(pluginManager, "pluginManager");
            Util.ThrowIfParameterNull(pluginManager, "mainWindow");

            _pluginManager = pluginManager;
            _mainWindow = mainWindow;
        }
开发者ID:robhoes,项目名称:xenadmin,代码行数:13,代码来源:ContextMenuBuilder.cs

示例12: Init

 public void Init()
 {
     LayoutBuilder = new DefaultLayoutBuilder();
     RenderManager = new RenderManager(LayoutBuilder);
     PluginManager = new PluginManager(RenderManager, LayoutBuilder);
     AmbilightManager = new AmbilightManager(RenderManager, LayoutBuilder);
     PowerManager = new PowerManager(RenderManager);
 }
开发者ID:Urmel11,项目名称:wordclockPI,代码行数:8,代码来源:WordclockSettings.cs

示例13: GenerateAdditionalMethodsPluginCode

 public static void GenerateAdditionalMethodsPluginCode(PluginManager pluginManager,
     ICodeBlock codeBlock, IElement element)
 {
     foreach (ComponentPluginPair cpp in GetPluginsIn(pluginManager))
     {
         GenerateWithException(cpp.Generator.GenerateAdditionalMethods, codeBlock, element, cpp.Plugin, pluginManager);
     }
 }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:8,代码来源:ICodeGeneratorPlugin.cs

示例14: CallCodeGenerationStart

        public static void CallCodeGenerationStart(PluginManager pluginManager, IElement element)
        {
            foreach (ICodeGeneratorPlugin plugin in pluginManager.CodeGeneratorPlugins)
            {
                plugin.CodeGenerationStart(element);

            }
        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:8,代码来源:ICodeGeneratorPlugin.cs

示例15: Configure_need_ConfigureServicesBefore

        public void Configure_need_ConfigureServicesBefore()
        {
            var loaderMock = new Mock<IPluginLoader>();
            var target = new PluginManager(loaderMock.Object);

            Action init2 = () =>target.Configure(new Mock<IApplicationBuilder>().Object);

            Assert.Throws<InvalidOperationException>(init2);
        }
开发者ID:genusP,项目名称:AspNet5-Modularity,代码行数:9,代码来源:PluginManagerTests.cs


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