public bool Install(Skin skin) { Uninstall(); string location = "/Skins/" + skin.Name; IPluginManager pluginManager = ServiceRegistration.Get <IPluginManager>(); PluginItemMetadata md = pluginManager.GetPluginItemMetadata(location, BACKGROUND_PLUGIN_ITEM_ID); if (md == null) { return(false); } try { _backgroundLocation = location; _backgroundManager = pluginManager.RequestPluginItem <IBackgroundManager>( _backgroundLocation, BACKGROUND_PLUGIN_ITEM_ID, this); _backgroundManager.Install(); return(true); } catch (PluginInvalidStateException e) { ServiceRegistration.Get <ILogger>().Warn("Cannot install background manager for {0}", e, location); } return(false); }
/// <summary> /// Releases the config object if it is a <see cref="ConfigSetting"/>. /// </summary> public void DisposeConfigObj() { IPluginManager pluginManager = ServiceRegistration.Get <IPluginManager>(); string itemLocation = Constants.PLUGINTREE_BASELOCATION + (_parent == null ? string.Empty : _parent.Location); ConfigSetting cs = _configObj as ConfigSetting; if (cs != null) { PluginItemMetadata pid = pluginManager.GetPluginItemMetadata(itemLocation, Id); if (pid == null) { return; } pid.PluginRuntime.RevokePluginObject(cs.GetType().FullName); } }