public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { ThreadHelper.ThrowIfNotOnUIThread( ); int retVal = InnerTarget?.Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut) ?? VSConstants.S_OK; if ((nCmdID == ( uint )VSConstants.VSStd2KCmdID.StartPage) && (pguidCmdGroup == VSConstants.VSStd2K)) { // post work onto UI thread after a 1 second delay. This ensures the page is // actually created before attempting to modify any of the page's content. // JoinableTaskFactory is the WRONG thing to do here, as it blocks everything // from the UI thread until the entire task completes and this is already on // the UI thread. Task.Delay(1000).ConfigureAwait(true).GetAwaiter( ).OnCompleted(EnableNewsFeed); } return(retVal); }
/// <summary> /// Overrides <see cref="TargetBase.SupportsType(Type)"/> to forward the call to <see cref="InnerTarget"/>. /// </summary> /// <param name="type">The type which is to be checked.</param> /// <returns><c>true</c> if the type is compatible with the object created by <see cref="InnerTarget"/>, <c>false</c> /// if not.</returns> public override bool SupportsType(Type type) { return(InnerTarget.SupportsType(type)); }
public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) { ThreadHelper.ThrowIfNotOnUIThread( ); return(InnerTarget?.QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText) ?? VSConstants.S_OK); }