/// <summary> /// Opens the specified item with the specified editor using the primary logical view. /// </summary> /// <returns> /// The <see cref="IVsWindowFrame"/> that contains the editor; otherwise, <see langword="null"/> if it was opened /// with an editor external of Visual Studio. /// </returns> public static IVsWindowFrame?OpenItemWithSpecific(this IVsProject4 project, HierarchyId id, Guid editorType) { Requires.NotNull(project, nameof(project)); Verify.HResult(project.OpenItemWithSpecific(id, 0, ref editorType, "", VSConstants.LOGVIEWID_Primary, (IntPtr)(-1), out IVsWindowFrame frame)); // NOTE: frame is 'null' when opened in an external editor return(frame); }
/// <summary> /// Opens the specified item with the specified editor using the primary logical view. /// </summary> /// <returns> /// The <see cref="IVsWindowFrame"/> that contains the editor; otherwise, <see langword="null"/> if it was opened /// with an editor external of Visual Studio. /// </returns> public static IVsWindowFrame OpenItemWithSpecific(this IVsProject4 project, HierarchyId id, Guid editorType) { Requires.NotNull(project, nameof(project)); IVsWindowFrame frame; HResult hr = project.OpenItemWithSpecific(id, 0, ref editorType, "", VSConstants.LOGVIEWID_Primary, (IntPtr)(-1), out frame); if (hr.Failed) { throw hr.Exception; } // NOTE: frame is 'null' when opened in an external editor return(frame); }