本文整理汇总了C#中IPlugin.StartUp方法的典型用法代码示例。如果您正苦于以下问题:C# IPlugin.StartUp方法的具体用法?C# IPlugin.StartUp怎么用?C# IPlugin.StartUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlugin
的用法示例。
在下文中一共展示了IPlugin.StartUp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartupPlugin
protected void StartupPlugin(IPlugin plugin)
{
// See if the plugin already exists - it may implement multiple interfaces
if (!mPluginContainers.ContainsKey(plugin))
{
PluginContainer pluginContainer = new PluginContainer(plugin);
mPluginContainers.Add(plugin, pluginContainer);
try
{
plugin.StartUp();
}
catch (Exception e)
{
pluginContainer.Fail(e, "Plugin failed in StartUp");
}
}
}
示例2: StartupPlugin
//internal static void Initialize()
//{
// if (mGlobalInstance == null)
// {
// mGlobalInstance = new PluginManager(true);
// LoadPlugins(mGlobalInstance);
// }
// if (mProjectInstance != null)
// {
// foreach (IPlugin plugin in mProjectInstance.mPluginContainers.Keys)
// {
// ShutDownPlugin(plugin, PluginShutDownReason.GlueShutDown);
// }
// }
// mProjectInstance = new PluginManager(false);
// mInstances.Clear();
// mInstances.Add(mGlobalInstance);
// mInstances.Add(mProjectInstance);
// LoadPlugins(mProjectInstance);
//}
internal static void StartupPlugin(IPlugin plugin, PluginManager instance)
{
// See if the plugin already exists - it may implement multiple interfaces
if (!instance.mPluginContainers.ContainsKey(plugin))
{
PluginContainer pluginContainer = new PluginContainer(plugin);
instance.mPluginContainers.Add(plugin, pluginContainer);
try
{
plugin.UniqueId = plugin.GetType().FullName;
if (!mPluginSettingsSave.DisabledPlugins.Contains(plugin.UniqueId))
{
plugin.StartUp();
}
else
{
pluginContainer.IsEnabled = false;
}
}
catch (Exception e)
{
#if DEBUG
MessageBox.Show("Plugin failed to start up:\n\n" + e.ToString());
#endif
pluginContainer.Fail(e, "Plugin failed in StartUp");
}
}
}