示例#1
0
        private void switchToPage(params object[] args)
        {
            Expandable exa  = (Expandable)args[0];
            Type       type = exa.GetType();
            TabPage    page = tabControl.TabPages.Cast <TabPage>().FirstOrDefault(_ => _.Tag.GetType().Equals(type));

            if (page != null)
            {
                tabControl.SelectedTab = page;
            }
        }
示例#2
0
        private void unloadModule(Expandable exa)
        {
            Type type = exa.GetType();
            IEnumerable <Control> ien = tabControl.Controls.Cast <Control>();
            TabPage page = (TabPage)ien.Where(_ => type.Equals(_.Tag.GetType())).First();

            removeMenuStripItems(exa);

            Core.saveConfig(exa, exa.config, exa.hotkeys);
            tabControl.Controls.Remove(page);
            exa.quit();

            Core.runningModules.Remove(exa);
            Core.setModuleEnabled(exa.dllFileName, false);
        }
示例#3
0
        private void loadModule(Expandable exa)
        {
            SuspendLayout();

            if (exa.dllFileName == Core.CORE_ID)
            {
                exa.run();
                return;
            }

            TabPage tpage = new TabPage(exa.getTitle())
            {
                Padding  = new Padding(3),
                TabIndex = tabControl.TabCount,
                UseVisualStyleBackColor = true,
                Tag = exa
            };

            tpage.Controls.Add(exa.mainPanel);


            tabControl.Controls.Add(tpage);
            ToolStripMenuItem item = modulesToolStripMenuItem.DropDown.Items.Cast <ToolStripMenuItem>()
                                     .Where(_ => _.Tag.GetType().Equals(exa.GetType())).First();

            loadMenuStripItems(exa);

            exa.run();
            Core.runningModules.Add(exa);

            exa.mainPanel.Size = new Size(1, 1);
            exa.mainPanel.Dock = DockStyle.Fill;

            if (exa.hotkeys != null)
            {
                Core.enableHotkeys(exa.dllFileName, exa.hotkeys);
            }
            if (Core.globalHotkey.availableHotkeys == null ||
                Core.globalHotkey.availableHotkeys == string.Empty)
            {
                Core.globalHotkey.availableHotkeys = exa.dllFileName;
            }

            Core.setModuleEnabled(exa.dllFileName, true);
            item.Checked = true;

            ResumeLayout();
        }