Beispiel #1
0
        void LoadModule(System.Windows.Controls.Control addIn)
        {
            FormContainer doc = this.FindAddInContainer(addIn);

            if (doc == null)
            {
                doc     = CreateAddInContainer(addIn);
                doc.Tag = addIn;

                //注册模块。
                this.m_AddIns.Add(doc.ExplorerControl);
                //删除事件。
                doc.FormClosed += (s, e) =>
                {
                    if (this.m_AddIns.Contains(doc.ExplorerControl))
                    {
                        MessageExchange.Singleton.Unsubscribe(doc.ExplorerControl);
                        MessageExchange.RemoveNotify(doc.ExplorerControl);
                        this.m_AddIns.Remove(doc.ExplorerControl);
                    }
                };
            }
            else
            {
                AddInActivate(addIn);
            }
        }
Beispiel #2
0
        FormContainer CreateAddInContainer(object addIn)
        {
            FormContainer fc = new FormContainer(this);

            fc.Tag = addIn;

            if (addIn is Control)
            {
                fc.Start(addIn as Control);
            }
            else if (addIn is System.Windows.Controls.Control)
            {
                fc.Start(addIn as System.Windows.Controls.Control);
            }

            fc.MdiParent   = this;
            fc.WindowState = FormWindowState.Maximized;
            fc.Show();
            fc.Update();
            return(fc);
        }