private void mi_loadDrawing(object sender, EventArgs e) { MenuItem mi = sender as MenuItem; if (mi != null) { IDrawDesignControl drc = mi.Tag as IDrawDesignControl; if (drc != null && drc.Item != null) { IDesignerHost host = (IDesignerHost)this.GetService(typeof(IDesignerHost)); if (host != null) { HostSurface surface = host.GetService(typeof(DesignSurface)) as HostSurface; if (surface != null) { ClassPointer root = surface.Loader.GetRootId(); if (root != null) { ILimnorDesignerLoader ldp = root.GetDesignerLoader(); if (ldp != null) { IDesignPane idp = ldp.DesignPane as IDesignPane; OpenFileDialog dlg = new OpenFileDialog(); dlg.CheckFileExists = true; dlg.DefaultExt = ".xml"; dlg.Filter = "XML files|*.xml"; dlg.Title = "Select XML file for loading drawing"; if (dlg.ShowDialog(drc.Item.Page) == DialogResult.OK) { drc.Item.LoadDrawingsFromFile(dlg.FileName, idp, drc); } } } } } } } }