Udostępnij za pośrednictwem


IVsUserContext.AdviseUpdate(IVsUserContextUpdate, UInt32) Method

Definition

Enables clients to receive notification when the user context property bag is changed.

public:
 int AdviseUpdate(Microsoft::VisualStudio::Shell::Interop::IVsUserContextUpdate ^ pUpdate, [Runtime::InteropServices::Out] System::UInt32 % pdwCookie);
int AdviseUpdate(Microsoft::VisualStudio::Shell::Interop::IVsUserContextUpdate const & pUpdate, [Runtime::InteropServices::Out] unsigned int & pdwCookie);
public int AdviseUpdate (Microsoft.VisualStudio.Shell.Interop.IVsUserContextUpdate pUpdate, out uint pdwCookie);
abstract member AdviseUpdate : Microsoft.VisualStudio.Shell.Interop.IVsUserContextUpdate * uint32 -> int
Public Function AdviseUpdate (pUpdate As IVsUserContextUpdate, ByRef pdwCookie As UInteger) As Integer

Parameters

pUpdate
IVsUserContextUpdate

[in] Pointer to the IVsUserContextUpdate interface, which sends an update notification.

pdwCookie
UInt32

[out, retval] Unique identifier for the referenced event sink. This value is required to unadvise the event sink using UnadviseUpdate(UInt32).

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From context.idl:

HRESULT IVsUserContext::AdviseUpdate(  
   [in] IVsUserContextUpdate * pUpdate,  
   [out, retval] VSCOOKIE * pdwCookie  
);  

When you create a context bag on an editor, call IVsUserContext.AdviseUpdate and pass along a pointer to your context provider. When Update is called internally by the environment, each context bag and associated subcontext bag is flagged as dirty using the SetDirty method. However, if the context bag is on an editor window that has called IVsUserContext.AdviseUpdate and has also implemented the IVsUserContextUpdate interface, then the environment calls UpdateUserContext to inform the context provider that the context bag will be updated (that is, Update will be called). For more information, see Providing Context for an Editors and Designers.

To disable notification of user context updates, call UnadviseUpdate.

Applies to