示例#1
0
        private DockableForm Create(string name, bool show)
        {
            // First try to create it.
            DockableForm newForm = formFactory.Create(name);

            if (newForm != null)
            {
                // Assure only one instance.
                if (!(newForm is DocumentForm))
                {
                    // We only allow a single instance of this.
                    foreach (DockableForm f in dockedForms)
                    {
                        if (f.GetType().Equals(newForm.GetType()))
                        {
                            return(null);
                        }
                    }
                }

                // Ok we can allow it being hosted so add it.
                dockedForms.Add(newForm);
                newForm.Text = name;

                if (show)
                {
                    newForm.Show(dockPanel, newForm.DefaultDockState);
                }

                return(newForm);
            }

            return(null);
        }
示例#2
0
        public void Register <FormType>(string name) where FormType : DockableForm, new()
        {
            formFactory.Register <FormType>(name);

            DockableForm testForm = formFactory.Create(name);

            if (testForm != null)
            {
                if (testForm is DocumentForm)
                {
                    documentFormTypes.Add(name);
                }

                dockedForms.Remove(testForm);
                testForm.Dispose();
            }
        }
示例#3
0
 public void Remove(DockableForm form)
 {
     dockedForms.Remove(form);
 }
示例#4
0
 public void Add(string name)
 {
     DockableForm newForm = Create(name, true);
 }