private void notifyPluginsHost(NotificationType type, int value, Plugin plugin) { switch (type) { case NotificationType.ResetAll: ResetAll(value); break; case NotificationType.Reset: plugin.NotificationsCount = value; break; case NotificationType.Update: plugin.NotificationsCount += value; break; case NotificationType.ShowBusyIndicator: _guiModelData.IsBusy = true; break; case NotificationType.HideBusyIndicator: _guiModelData.IsBusy = false; break; } }
private void loadPlugins(string path) { foreach (var pluginPath in Directory.GetFiles(path, "*.dll")) { if (isAlreadyLoaded(pluginPath)) continue; var pluginAssembly = Assembly.LoadFrom(pluginPath); var profilerPlugin = pluginAssembly.GetTypes() .FirstOrDefault(type => typeof(ProfilerPluginBase).IsAssignableFrom(type)); if (profilerPlugin == null) continue; var pluginInstance = Activator.CreateInstance(profilerPlugin) as ProfilerPluginBase; if (pluginInstance == null) continue; pluginInstance.ProfilerData = _profilerData; var plugin = new Plugin { PluginAssembly = pluginAssembly, ProfilerPlugin = pluginInstance }; if (plugin.Content == null) continue; pluginInstance.CustomDialogsService = _dialogManager; pluginInstance.CommonDialogsService = _commonDialogsService; pluginInstance.NotifyPluginsHost = (type, value) => { notifyPluginsHost(type, value, plugin); }; _plugins.Add(plugin); } }