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


C# PluginManager.Load方法代码示例

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


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

示例1: Load_WhenTheSamePluginIsLoadedTwice_TheSameInstanceIsReturned

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

            FakeCalculatorPlugin firstLoad = pluginManager.Load<FakeCalculatorPlugin>();
            FakeCalculatorPlugin secondLoad = pluginManager.Load<FakeCalculatorPlugin>();

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

示例2: Load_WhenTwoVersionsOfThePluginAreLoaded_OperationIsSuccessfull

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

            FakeCalculatorPlugin plugin = pluginManager.Load<FakeCalculatorPlugin>();
            FakeAnotherCalculatorPlugin anotherPlugin = pluginManager.Load<FakeAnotherCalculatorPlugin>();

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

示例3: 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

示例4: 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

示例5: 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

示例6: Render

        public Render(Ox ox)
            : base(ox)
        {
            Priority = (int)PriorityBase.Render -1;

            new Collision(Ox);
            plugins = new PluginManager<IOxRenderComponentPlugin>(Ox.Paths.Application);
            plugins.Load(new object[] { Ox, this });

            Ox.OnEvent += new OxEventHandler(Ox_OnEvent);
        }
开发者ID:yooyke,项目名称:work,代码行数:11,代码来源:Render.cs

示例7: Run

        public void Run()
        {
            string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            PluginManager<IUpdatePlugin> plugins = new PluginManager<IUpdatePlugin>(dir);
            plugins.Load(new object[] { });

            foreach (IUpdatePlugin plugin in plugins.Plugins)
                plugin.Run();

            plugins.Unload();
        }
开发者ID:yooyke,项目名称:work,代码行数:11,代码来源:UpdateCheck.cs

示例8: Load_WhenThePluginIsSpecified_IsIsLoadedIntoDifferentApplicationDomain

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

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

            string currentDomainName = AppDomain.CurrentDomain.FriendlyName;
            _testOutputHelper.WriteLine("Current Domain: {0}", currentDomainName);
            _testOutputHelper.WriteLine("Plugin Domain: {0}", fakePlugin.AppDomainName);
            Assert.NotEqual(currentDomainName, fakePlugin.AppDomainName);
        }
开发者ID:RamanBut-Husaim,项目名称:.NET-Practice,代码行数:11,代码来源:PluginManagerTests.cs

示例9: Viewer

        public Viewer(int windowWidth, int windowHeight, int mode)
        {
            new Controller(this);
            new Calculator(this);

            if (mode == (int)Loader.ModeType.Normal)
            {
                r_plugins = new PluginManager<IOxRenderPlugin>(this.Paths.Application);
                r_plugins.Load(new object[] { this });
                if (r_plugins.Plugins == null)
                    mode = (int)Loader.ModeType.Silent;
            }

            if (mode == (int)Loader.ModeType.Silent)
                new SilentRender(this);

            DataStore.Width = windowWidth;
            DataStore.Height = windowHeight;
        }
开发者ID:yooyke,项目名称:work,代码行数:19,代码来源:Viewer.cs

示例10: Load_WhenTheLifetimeIsExpired_ThePluginIsUnloaded

        public void Load_WhenTheLifetimeIsExpired_ThePluginIsUnloaded(int waitMilliseconds)
        {
            using (var autoResetEvent = new AutoResetEvent(false))
            {
                var fakePluginLifetimeManagerFactory = new FakePluginLifetimeManagerFactory(autoResetEvent);

                var pluginManager = new PluginManager(
                    AppDomain.CurrentDomain.BaseDirectory,
                    TimeSpan.FromMilliseconds(waitMilliseconds),
                    TimeSpan.FromMilliseconds(waitMilliseconds),
                    fakePluginLifetimeManagerFactory);

                var plugin = pluginManager.Load<FakeCalculatorPlugin>();

                autoResetEvent.WaitOne(TimeSpan.FromMinutes(1));

                var pluginLifetimeManager = fakePluginLifetimeManagerFactory.LastPluginLifetimeManager as FakePluginLifetimeManager<FakeCalculatorPlugin>;

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

示例11: InitPlugin

        private void InitPlugin()
        {
            if (plugins != null)
                CleanupPlugin();

            string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            plugins = new PluginManager<IViewerPlugin>(dir);
            plugins.Load(new object[] { width, height, mode });
        }
开发者ID:yooyke,项目名称:work,代码行数:10,代码来源:Loader.cs

示例12: Unload_WhenThePluginHasBeenLoaded_TheUnloadWillBeSuccessfull

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

            var plugin = pluginManager.Load<FakeCalculatorPlugin>();
            pluginManager.Unload<FakeCalculatorPlugin>();

            Assert.Throws<AppDomainUnloadedException>(() => plugin.IsPrime(3));
        }
开发者ID:RamanBut-Husaim,项目名称:.NET-Practice,代码行数:9,代码来源:PluginManagerTests.cs

示例13: IsLoaded_WhenTheTypeWasUnloaded_ReturnsFalse

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

            pluginManager.Load<FakeCalculatorPlugin>();
            pluginManager.Unload<FakeCalculatorPlugin>();

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

示例14: Unload_WhenOneVersionOfThePluginIsUnloaded_TheSecondExists

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

            pluginManager.Load<FakeCalculatorPlugin>();
            pluginManager.Load<FakeAnotherCalculatorPlugin>();

            pluginManager.Unload<FakeCalculatorPlugin>();

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

示例15: Unload_WhenThePluginUnloadedSecondTime_TheExceptionOccurs

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

            pluginManager.Load<FakeCalculatorPlugin>();
            pluginManager.Unload<FakeCalculatorPlugin>();

            Assert.Throws<InvalidOperationException>(() => pluginManager.Unload<FakeCalculatorPlugin>());
        }
开发者ID:RamanBut-Husaim,项目名称:.NET-Practice,代码行数:9,代码来源:PluginManagerTests.cs


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