public static PackageBuilderPane CreateEditor([NotNull] string documentName) { Assert.ArgumentNotNull(documentName, nameof(documentName)); documentName = EditorDocumentName.GetDocumentName(documentName); var windowFrame = CreateFrame(documentName, GuidList.PackageBuilderFactoryString); if (windowFrame == null) { return(null); } windowFrame.Show(); object value; windowFrame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out value); var pane = value as PackageBuilderPane; if (pane != null) { pane.Frame = windowFrame; } return(pane); }
public override T OpenDocument <T>(string documentName) { Assert.ArgumentNotNull(documentName, nameof(documentName)); documentName = EditorDocumentName.GetDocumentName(documentName); IVsWindowFrame frame; IVsUIHierarchy hierarchy; uint itemId; if (VsShellUtilities.IsDocumentOpen(SitecorePackage.Instance, documentName, VSConstants.LOGVIEWID_Primary, out hierarchy, out itemId, out frame)) { frame.Show(); return(null); } var result = new T(); FrameworkElement frameworkElement; var formsControls = result as Control; if (formsControls != null) { frameworkElement = new WindowsFormsHost { Child = formsControls }; } else { frameworkElement = result as FrameworkElement; } Assert.IsNotNull(frameworkElement, "Parameter 'control' must be of type FrameworkElement"); EditorWindowFactory.CreateEditor(frameworkElement, documentName); return(result); }