Beispiel #1
0
    protected void OnRemoveActionActivated(object sender, EventArgs e)
    {
        Gtk.ResponseType responseType  = Gtk.ResponseType.None;
        LoadedPlugins    loadedPlugins = new LoadedPlugins(plugins);

        try {
            responseType = (Gtk.ResponseType)loadedPlugins.Run();

            if (responseType == Gtk.ResponseType.Ok)
            {
                Gtk.TreeModel     model;
                Gtk.TreeIter      iter;
                Gtk.TreeSelection selection = loadedPlugins.treeView.Selection;

                selection.GetSelected(out model, out iter);

                string pluginToDelete = (model.GetValue(iter, 0).ToString());
                removePlugin(pluginToDelete);
                //plugins.RemovePlugin(pluginToDelete);
                //DockItem item = DockFrame.GetItem(pluginToDelete);
                //item.Visible = false;
                //dockFrame.RemoveItem(item);
                SaveLayout();
            }
        }
        finally {
            loadedPlugins.Hide();
            loadedPlugins.Dispose();
        }
    }
Beispiel #2
0
    protected void OnRemoveActionActivated(object sender, EventArgs e)
    {
        Gtk.ResponseType responseType  = Gtk.ResponseType.None;
        LoadedPlugins    loadedPlugins = new LoadedPlugins(plugins);

        try {
            responseType = (Gtk.ResponseType)loadedPlugins.Run();

            if (responseType == Gtk.ResponseType.Ok)
            {
                Gtk.TreeModel  treeModel;
                Gtk.TreeIter   iter;
                Gtk.TreePath[] selectedRows = null;
                selectedRows = loadedPlugins.treeView.Selection.GetSelectedRows();

                for (int i = 0; i < selectedRows.Length; i++)
                {
                    loadedPlugins.lsLoadedPlugins.GetIter(out iter, selectedRows[i]);
                    string          pluginPath = (string)loadedPlugins.lsLoadedPlugins.GetValue(iter, 0);
                    PluginInfo      pluginInfo = plugins.Plugins.Find(x => x.codeBase == pluginPath);
                    List <IService> services   = plugins.GetServices(pluginInfo);

                    foreach (IService service in services)
                    {
                        plugins.RemovePlugin(pluginInfo.codeBase);
                        (service as IPlugin).UnInit(null);
                    }
                }
            }
        }
        finally {
            loadedPlugins.Hide();
        }
    }