다음을 통해 공유


IVsUserContext.AdviseUpdate Method

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)

Syntax

'Declaration
Function AdviseUpdate ( _
    pUpdate As IVsUserContextUpdate, _
    <OutAttribute> ByRef pdwCookie As UInteger _
) As Integer
int AdviseUpdate(
    IVsUserContextUpdate pUpdate,
    out uint pdwCookie
)
int AdviseUpdate(
    [InAttribute] IVsUserContextUpdate^ pUpdate, 
    [OutAttribute] unsigned int% pdwCookie
)
abstract AdviseUpdate : 
        pUpdate:IVsUserContextUpdate * 
        pdwCookie:uint32 byref -> int
function AdviseUpdate(
    pUpdate : IVsUserContextUpdate, 
    pdwCookie : uint
) : int

Parameters

  • pdwCookie
    Type: UInt32%

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

Return Value

Type: Int32
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.

.NET Framework Security

See Also

Reference

IVsUserContext Interface

Microsoft.VisualStudio.Shell.Interop Namespace