private IVsUserContext GetUserContext() { RecreateContext(); if (_Context == null) { if (_ServiceProvider == null) { return(null); } IVsWindowFrame frame = (IVsWindowFrame)_ServiceProvider.GetService(typeof(IVsWindowFrame)); if (frame != null) { object obj2; NativeMethods.ThrowOnFailure(frame.GetProperty(-3010, out obj2)); _Context = (IVsUserContext)obj2; } if (_Context == null) { IVsMonitorUserContext context = (IVsMonitorUserContext)_ServiceProvider.GetService(typeof(IVsMonitorUserContext)); if (context != null) { NativeMethods.ThrowOnFailure(context.CreateEmptyContext(out _Context)); if (((_Context != null) && (frame != null)) && IsToolWindow(frame)) { NativeMethods.ThrowOnFailure(frame.SetProperty(-3010, _Context)); } } } if ((_SubContextList != null) && (_Context != null)) { foreach (object obj3 in _SubContextList) { HelpService service = obj3 as HelpService; if (service != null) { service.RecreateContext(); } } } } return(_Context); }