private static Form GetMdiForm(XmlDocument doc, bool valid)
        {
            IXEditNetProfile prof = ProfileProvider.GetProfile(doc);

            UserControl userControl = null;

            if (prof != null)
            {
                userControl = prof.GetEditorRegion(doc);
            }

            if (userControl == null)
            {
                userControl = new XEditNetDefaultEditorRegion();
            }

            IXEditNetEditorRegion r = userControl as IXEditNetEditorRegion;

            if (r == null)
            {
                throw new InvalidOperationException("User control returned by profile does not implement " + typeof(IXEditNetEditorRegion));
            }

            if (prof != null && prof.Info.Stylesheet != null && prof.Info.Stylesheet.Length > 0)
            {
                r.Editor.SetStylesheet(prof.Info.Stylesheet);
            }

            r.Editor.Attach(doc, valid);
            XEditNetChildForm form = new XEditNetChildForm(userControl);

            return(form);
        }
        private void ChildClosing(object sender, CancelEventArgs e)
        {
            XEditNetChildForm child = (XEditNetChildForm)sender;

            if (!ConfirmSave(child.Editor, (FileInfo)((Form)child).Tag))
            {
                e.Cancel = true;
            }
        }
        private static Form GetMdiForm(XmlDocument doc, bool valid)
        {
            IXEditNetProfile prof=ProfileProvider.GetProfile(doc);

            UserControl userControl=null;

            if ( prof != null )
                userControl=prof.GetEditorRegion(doc);

            if ( userControl == null )
                userControl=new XEditNetDefaultEditorRegion();

            IXEditNetEditorRegion r=userControl as IXEditNetEditorRegion;
            if ( r == null )
                throw new InvalidOperationException("User control returned by profile does not implement "+typeof(IXEditNetEditorRegion));

            if ( prof != null && prof.Info.Stylesheet != null && prof.Info.Stylesheet.Length > 0 )
                r.Editor.SetStylesheet(prof.Info.Stylesheet);

            r.Editor.Attach(doc, valid);
            XEditNetChildForm form=new XEditNetChildForm(userControl);

            return form;
        }