Exemplo n.º 1
0
        /// <summary>
        /// Loads a plugin using the Add command from the Plugins menu.
        /// </summary>
        /// <param name='sender'>
        /// Sender.
        /// </param>
        /// <param name='e'>
        /// Event args.
        /// </param>
        protected void OnAddActionActivated(object sender, EventArgs e)
        {
            var fc = new Gtk.FileChooserDialog("Choose the file to open", null,
                                               Gtk.FileChooserAction.Open, "Cancel",
                                               Gtk.ResponseType.Cancel, "Open", Gtk.ResponseType.Accept);

            try {
                fc.SelectMultiple = true;
                fc.SetCurrentFolder(Environment.CurrentDirectory);
                if (fc.Run() == (int)Gtk.ResponseType.Accept)
                {
                    PluginServiceContainer pluginsToAdd = new PluginServiceContainer();
                    for (int i = 0; i < fc.Filenames.Length; i++)
                    {
                        if (!plugins.Plugins.Exists(x => x.codeBase == fc.Filenames[i]))
                        {
                            plugins.AddPlugin(fc.Filenames[i]);
                            pluginsToAdd.AddPlugin(fc.Filenames[i]);
                        }
                    }

                    pluginsToAdd.LoadPlugins();
                    foreach (IPlugin p in pluginsToAdd.GetServices <IPlugin>())
                    {
                        p.Init(this);
                    }
                }
            } finally {
                fc.Destroy();
            }
        }
Exemplo n.º 2
0
        public void PluginServiceContainer_UnitTest_ExecuteWhereHasPluginServiceExecution_Guid()
        {
            //------------Setup for test--------------------------
            var           mockServiceExecution = new Mock <IServiceExecution>();
            ErrorResultTO errors;
            Guid          expected = Guid.NewGuid();

            mockServiceExecution.Setup(execution => execution.Execute(out errors, 0)).Returns(expected);
            PluginServiceContainer pluginServiceContainer = new PluginServiceContainer(mockServiceExecution.Object);
            //------------Execute Test---------------------------
            Guid actual = pluginServiceContainer.Execute(out errors, 0);

            //------------Assert Results-------------------------
            Assert.AreEqual(expected, actual, "Execute should return the Guid from the service execution");
        }
Exemplo n.º 3
0
        public LoadedPlugins(PluginServiceContainer plugins)
        {
            this.Build();

            this.treeView = treeview1;
            Gtk.TreeViewColumn column = new Gtk.TreeViewColumn();
            column.Title = "Loaded plugins";
            treeview1.AppendColumn(column);

            Gtk.ListStore        loadedPlugins = new Gtk.ListStore(typeof(string));
            Gtk.CellRendererText cell          = new Gtk.CellRendererText();

            column.PackStart(cell, true);
            column.AddAttribute(cell, "text", 0);

            for (int i = 0; i < plugins.Plugins.Count; i++)
            {
                loadedPlugins.AppendValues(System.IO.Path.GetFileName(plugins.Plugins[i].codeBase));
            }

            treeview1.Model = loadedPlugins;
        }
Exemplo n.º 4
0
        private EsbExecutionContainer GenerateContainer(ServiceAction serviceAction, IDSFDataObject dataObj, IWorkspace theWorkspace)
        {
            // set the ID for later use ;)
            dataObj.WorkspaceID = _workspace.ID;

            EsbExecutionContainer result = null;

            switch (serviceAction.ActionType)
            {
            case Common.Interfaces.Core.DynamicServices.enActionType.InvokeManagementDynamicService:
                result = new InternalServiceContainer(serviceAction, dataObj, theWorkspace, _esbChannel, _request);
                break;

            case Common.Interfaces.Core.DynamicServices.enActionType.InvokeStoredProc:
                result = new DatabaseServiceContainer(serviceAction, dataObj, theWorkspace, _esbChannel);
                break;

            case Common.Interfaces.Core.DynamicServices.enActionType.InvokeWebService:
                result = new WebServiceContainer(serviceAction, dataObj, theWorkspace, _esbChannel);
                break;

            case Common.Interfaces.Core.DynamicServices.enActionType.Plugin:
                result = new PluginServiceContainer(serviceAction, dataObj, theWorkspace, _esbChannel);
                break;

            case Common.Interfaces.Core.DynamicServices.enActionType.Workflow:
                result = new WfExecutionContainer(serviceAction, dataObj, theWorkspace, _esbChannel);
                break;

            case Common.Interfaces.Core.DynamicServices.enActionType.RemoteService:
                result = new RemoteWorkflowExecutionContainer(serviceAction, dataObj, null, _esbChannel);
                break;
            }

            return(result);
        }