public static void ExecuteMainWindowLoadedProcessors(Window mainWindow) { foreach (var plugin in PluginManager.GetEnabledPlugins()) { try { var xml = plugin.PluginXmlDocument; const string xpath = "/plugin/mainWindow/loaded/processor"; foreach (XmlElement processorNode in xml.SelectElements(xpath)) { var obj = (IMainWindowLoadedProcessor)Plugin.CreateInstance(processorNode); ExecuteAsync(() => obj.Process(mainWindow)); } } catch (Exception ex) { PluginManager.HandleError(plugin, ex); } } }
private static void ExecuteInitProcessor(XmlElement processorNode) { using (new ProfileSection("Execute <init> processor", typeof(PluginManager))) { ProfileSection.Argument("processorNode", processorNode); var isAsync = processorNode.GetAttribute("mode").EqualsIgnoreCase("async"); var obj = (IInitProcessor)Plugin.CreateInstance(processorNode); if (!isAsync) { obj.Process(); ProfileSection.Result("Done"); return; } ExecuteAsync(obj.Process); ProfileSection.Result("Started async"); } }