private void InitializeExecutionEngine() { // Only SystemTrace should be useable during constructor _simulator.SetServiceContext(FrameworkServicesContext.ExecutionConstructor); _executionEngine = _simulator.CreateExecutionEngine(); // Initialize the rest of the execution services _simulator.SetServiceContext(FrameworkServicesContext.Execution); // Add control to the UI SetPanelControl(pluginExecutionPanel, _executionEngine as Control); }
private void CreatePlugin() { TraceFactory.Logger.Debug("Loading plugin instance for {0} activity '{1}'".FormatWith(ActivityType, Name)); try { _plugin = PluginFactory.GetPlugin(ActivityType).Create <IPluginExecutionEngine>(); } catch (PluginLoadException ex) { TraceFactory.Logger.Error($"Unable to load plugin for Activity Type: {ActivityType}", ex); throw; } }
/// <summary> /// Adds plugin to main tab control. /// </summary> /// <param name="activityInfo">Activity details</param> /// <param name="plugin">The item.</param> private void AddToMainTabControl(ActivityInfo activityInfo, IPluginExecutionEngine plugin) { TraceFactory.Logger.Info("Enter addToMainTabControl"); if (mainTabControl.InvokeRequired) { TraceFactory.Logger.Info("Enter Invokerequired"); mainTabControl.Invoke(new MethodInvoker(() => AddToMainTabControl(activityInfo, plugin))); return; } // If the plugin is not a UserControl, then there is no need to add it to the tab control. if (!(plugin is Control)) { TraceFactory.Logger.Info("Plugin '{0}' is not a UserControl plugin, thus do not add it to the tab.".FormatWith(activityInfo.ActivityType)); return; } TraceFactory.Logger.Debug("Creating plugin tab page: " + activityInfo.ActivityType); Control control = (Control)plugin; control.Dock = DockStyle.Fill; TabPage tabPage = new TabPage(activityInfo.ActivityType); try { tabPage.Name = activityInfo.Id.ToString(); tabPage.Controls.Add(control); TraceFactory.Logger.Debug("Plugin attached to tab page"); mainTabControl.Controls.Add(tabPage); TraceFactory.Logger.Debug("Tab page added to main page"); } catch { tabPage.Dispose(); throw; } }