IFilterTrackingProvider.TryAddTrackedFilter 方法

在派生类中重写时,将目标副本跟踪的筛选器通知源提供程序。

命名空间: Microsoft.Synchronization
程序集: Microsoft.Synchronization(在 microsoft.synchronization.dll 中)

语法

声明
Function TryAddTrackedFilter ( _
    filter As ISyncFilter _
) As Boolean
用法
Dim instance As IFilterTrackingProvider
Dim filter As ISyncFilter
Dim returnValue As Boolean

returnValue = instance.TryAddTrackedFilter(filter)
bool TryAddTrackedFilter (
    ISyncFilter filter
)
bool TryAddTrackedFilter (
    ISyncFilter^ filter
)
boolean TryAddTrackedFilter (
    ISyncFilter filter
)
function TryAddTrackedFilter (
    filter : ISyncFilter
) : boolean

参数

  • filter
    目标副本跟踪的筛选器。

返回值

如果源提供程序跟踪 filter 指定的筛选器,则为 true。否则为 false

备注

Sync Framework 会为目标副本跟踪的每个筛选器对源提供程序调用一次 TryAddTrackedFilter

示例

下面的示例检查源副本是否跟踪指定的筛选器。如果跟踪此筛选器,则此筛选器将添加到在同步期间更新的筛选器的列表中。

Public Function TryAddTrackedFilter(ByVal filter As ISyncFilter) As Boolean Implements IFilterTrackingProvider.TryAddTrackedFilter
    Dim isTracked As Boolean = False
    For Each addressFilter As AddressFilter In _ContactStore.TrackedFilters
        If addressFilter.IsIdentical(filter) Then
            _filterKeyMap.AddFilter(addressFilter)
            isTracked = True
            Exit For
        End If
    Next
    Return isTracked
End Function
public bool TryAddTrackedFilter(ISyncFilter filter)
{
    bool isTracked = false;
    foreach (AddressFilter addressFilter in _ContactStore.TrackedFilters)
    {
        if (addressFilter.IsIdentical(filter))
        {
            _filterKeyMap.AddFilter(addressFilter);
            isTracked = true;
            break;
        }
    }
    return isTracked;
}

请参阅

参考

IFilterTrackingProvider 接口
IFilterTrackingProvider 成员
Microsoft.Synchronization 命名空间