public PluginTabModel LoadPluginViewContext(IEnumerable <Lazy <IPlugin, IPluginMetadata> > plugins, int selectedIndex) { if (_cache.ContainsKey(selectedIndex)) { return(_cache[selectedIndex]); } var context = new PluginTabModel(); var plugin = plugins.ElementAt(selectedIndex); context.Metadata = plugin.Metadata; context.Enabled = !_settings.DisabledPlugins.Contains(context.Metadata.Guid); context.SettingsPanel = (plugin.Value as IConfigurablePlugin)?.GetConfigrationInterface(); var uri = new Uri(plugin.Metadata.IconUri, UriKind.RelativeOrAbsolute); if (IsLocalFile(uri)) { context.Icon = new BitmapImage(uri); } _cache.Add(selectedIndex, context); return(context); }
public void EnablePlugin(PluginTabModel context) { _settings.DisabledPlugins.Remove(context.Metadata.Guid); }
public void DisablePlugin(PluginTabModel context) { _settings.DisabledPlugins.Add(context.Metadata.Guid); }