IVsUserContext::AdviseUpdate Method (IVsUserContextUpdate^, UInt32)

 

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

Namespace:   Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

int AdviseUpdate(
	IVsUserContextUpdate^ pUpdate,
	[OutAttribute] unsigned int% pdwCookie
)

Parameters

pUpdate
Type: Microsoft.VisualStudio.Shell.Interop::IVsUserContextUpdate^

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

pdwCookie
Type: System::UInt32

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

Return Value

Type: System::Int32

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

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.

Return to top
Show: