예제 #1
0
        private void PluginView_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
        {
            if (e.Node.Tag == null)
            {
                return;
            }

            PluginInfo pluginInfo = e.Node.Tag as PluginInfo;

            if (pluginInfo.Plugin is IUserControlPlugin)
            {
                System.Windows.Forms.UserControl control = ((IUserControlPlugin)pluginInfo.Plugin).Content;
                panel1.Controls.Add(control); panel1.Visible = true;
                control.Dock = DockStyle.Fill;
            }
            else if (pluginInfo.Plugin is IFormPlugin)
            {
                IFormPlugin formPlugin = (IFormPlugin)pluginInfo.Plugin;
                Form        form       = formPlugin.Content;

                if (form.IsDisposed)
                {
                    form = PluginHelper.CreateNewInstance <Form>(pluginInfo.AssemblyPath);
                }

                if (formPlugin.ShowAs == ShowAs.Dialog)
                {
                    form.ShowDialog();
                }
                else
                {
                    form.Show();
                }
            }
        }
예제 #2
0
        public void Show(string plugin)
        {
            PluginInfo pi = FindPlugin(plugin);

            if (pi != null)
            {
                IFormPlugin fpi = pi.Instance as IFormPlugin;
                fpi.Show();
            }
        }
        void pluginItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menuItem   = sender as ToolStripMenuItem;
            PluginInfo        pluginInfo = menuItem.Tag as PluginInfo;
            IFormPlugin       plugin     = pluginInfo.Plugin as IFormPlugin;
            Form form = plugin.Content;

            if (form.IsDisposed)
            {
                form = PluginHelper.CreateNewInstance <Form>(pluginInfo.AssemblyPath);
            }

            if (plugin.ShowAs == ShowAs.Dialog)
            {
                form.ShowDialog();
            }
            else
            {
                form.Show();
            }
        }
예제 #4
0
        private void pluginTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node.Tag == null)
            {
                return;
            }

            PluginInfo pluginInfo = e.Node.Tag as PluginInfo;

            if (pluginInfo.Plugin is IUserControlPlugin)
            {
                UserControl control = ((IUserControlPlugin)pluginInfo.Plugin).Content;
                splitContainer.Panel2.Controls.Clear();
                splitContainer.Panel2.Controls.Add(control);
                control.Dock = DockStyle.Fill;
            }
            else if (pluginInfo.Plugin is IFormPlugin)
            {
                IFormPlugin formPlugin = (IFormPlugin)pluginInfo.Plugin;
                Form        form       = formPlugin.Content;

                if (form.IsDisposed)
                {
                    form = PluginHelper.CreateNewInstance <Form>(pluginInfo.AssemblyPath);
                }

                if (formPlugin.ShowAs == ShowAs.Dialog)
                {
                    form.ShowDialog();
                }
                else
                {
                    form.Show();
                }
            }
        }