本文整理汇总了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 ();
}
示例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();
}
示例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;
}
示例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");
}
示例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));
}
}
示例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();
}
示例7: LoadValidDataReaderPlugin
public void LoadValidDataReaderPlugin()
{
using (var pluginManager = new PluginManager(_pluginsDirectory))
{
pluginManager.DeployPluginAsync(_pluginAssemblyPath).Wait();
Assert.AreEqual(1, pluginManager.Plugins.Count());
}
}
示例8: Load_WhenThePluginExists_ReturnPluginInstance
public void Load_WhenThePluginExists_ReturnPluginInstance()
{
var pluginManager = new PluginManager(_addInRootPath);
ICalculatorPlugin calculatorPlugin = pluginManager.Load<ICalculatorPlugin>();
Assert.NotNull(calculatorPlugin);
}
示例9: Load_WhenTheTypeIsSpecified_ItIsLoaded
public void Load_WhenTheTypeIsSpecified_ItIsLoaded()
{
var pluginManager = new PluginManager(AppDomain.CurrentDomain.BaseDirectory);
FakeCalculatorPlugin fakePlugin = pluginManager.Load<FakeCalculatorPlugin>();
Assert.NotNull(fakePlugin);
}
示例10: IsLoaded_WhenPluginIsLoaded_ReturnsTrue
public void IsLoaded_WhenPluginIsLoaded_ReturnsTrue()
{
var pluginManager = new PluginManager(_addInRootPath);
ICalculatorPlugin calculatorPlugin = pluginManager.Load<ICalculatorPlugin>();
Assert.True(pluginManager.IsLoaded<ICalculatorPlugin>());
}
示例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;
}
示例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);
}
示例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);
}
}
示例14: CallCodeGenerationStart
public static void CallCodeGenerationStart(PluginManager pluginManager, IElement element)
{
foreach (ICodeGeneratorPlugin plugin in pluginManager.CodeGeneratorPlugins)
{
plugin.CodeGenerationStart(element);
}
}
示例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);
}