Exemplo n.º 1
0
        public void DeactivatePlugin(string pluginName)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new DeactivatePluginDelegate(this.DeactivatePlugin), new object[] { pluginName });
                return;
            }

            TabPage tabPage;
            int     pluginRowDGV = this.minaryMain.MinaryTaskFacade.GetPluginDgvRowByName(pluginName);

            if (this.minaryMain.UsedPlugins[pluginRowDGV].Active != "1")
            {
                return;
            }

            if ((tabPage = this.minaryMain.PluginHandler.FindTabPageInCatalog(pluginName)) == null)
            {
                throw new Exception("Plugin tab page could not be found");
            }

            // Set new status in the registry (to survive the application stop)
            WinRegistry.SetValue(this.minaryMain.UsedPlugins[pluginRowDGV].PluginName, "state", "off");

            // Set new status in the main GUI DGV
            this.minaryMain.MinaryTaskFacade.DeactivatePlugin(pluginName);
            this.minaryMain.MinaryTabPageHandler.HideTabPage(tabPage.Text);

            // Set new status in the tab page catalog
            this.TabPagesCatalog[pluginName].IsActive = false;
        }
Exemplo n.º 2
0
        public void ActivatePlugin(string pluginName)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new ActivatePluginDelegate(this.ActivatePlugin), new object[] { pluginName });
                return;
            }

            TabPage tabPage;
            int     pluginRowDgv = this.minaryMain.MinaryTaskFacade.GetPluginDgvRowByName(pluginName);

            if (pluginRowDgv < 0)
            {
                throw new Exception($"The plugin \"{pluginName}\" does not exist");
            }

            if (this.minaryMain.UsedPlugins[pluginRowDgv].Active != "0")
            {
                return;
            }

            if ((tabPage = this.minaryMain.PluginHandler.FindTabPageInCatalog(pluginName)) == null)
            {
                throw new Exception($"The plugin tab page \"{pluginName}\" could not be found");
            }

            // Set new status in the registry (to survive the application stop)
            WinRegistry.SetValue(pluginName, "state", "on");

            // Set new status in the main GUI DGV
            this.minaryMain.MinaryTaskFacade.ActivatePlugin(pluginName);
            this.minaryMain.MinaryTabPageHandler.ShowTabPage(tabPage.Text);

            // Set new status in the tab page catalog
            this.TabPagesCatalog[pluginName].IsActive = true;
        }