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); }
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(); } }
public void Remove(DockableForm form) { dockedForms.Remove(form); }
public void Add(string name) { DockableForm newForm = Create(name, true); }