다음을 통해 공유


SimpleSyncProvider.DestinationCallbacks 속성

파생 클래스에서 재정의되면 동기화 이벤트를 디스패치하는 데 사용되는 SyncCallbacks 개체를 가져옵니다.

네임스페이스: Microsoft.Synchronization.SimpleProviders
어셈블리: microsoft.synchronization.simpleproviders.dll의 Microsoft.Synchronization.SimpleProviders

구문

‘선언
Public ReadOnly Property DestinationCallbacks As SyncCallbacks
‘사용 방법
Dim instance As SimpleSyncProvider
Dim value As SyncCallbacks

value = instance.DestinationCallbacks
public SyncCallbacks DestinationCallbacks { get; }
public:
virtual property SyncCallbacks^ DestinationCallbacks {
    SyncCallbacks^ get () sealed;
}
/** @property */
public final SyncCallbacks get_DestinationCallbacks ()
public final function get DestinationCallbacks () : SyncCallbacks

속성 값

동기화 이벤트를 디스패치하는 데 사용되는 SyncCallbacks 개체입니다.

예제

다음 코드 예제에서는 예제 응용 프로그램을 사용하여 진행률과 상태를 콘솔에 보고할 수 있게 하는 이벤트 처리기를 만듭니다. 전체 응용 프로그램의 맥락에서 이 코드를 보려면 Sync Framework SDK 및 Code Gallery에서 사용할 수 있는 "Sync101 using Simple Sync Provider" 응용 프로그램을 참조하십시오.

static void RegisterCallbacks(Microsoft.Synchronization.SimpleProviders.SimpleSyncProvider provider)
{
    provider.DestinationCallbacks.FullEnumerationNeeded += new EventHandler<FullEnumerationNeededEventArgs>(DestinationCallbacks_FullEnumerationNeeded);
    provider.DestinationCallbacks.ItemChangeSkipped += new EventHandler<ItemChangeSkippedEventArgs>(DestinationCallbacks_ItemChangeSkipped);
    provider.DestinationCallbacks.ItemConflicting += new EventHandler<ItemConflictingEventArgs>(DestinationCallbacks_ItemConflicting);
    provider.DestinationCallbacks.ProgressChanged += new EventHandler<SyncStagedProgressEventArgs>(DestinationCallbacks_ProgressChanged);
}

static void DestinationCallbacks_ProgressChanged(object sender, SyncStagedProgressEventArgs e)
{
    if (e.Stage != SessionProgressStage.ChangeDetection)
    {
        Console.Write("Event Progress Changed: provider - {0}, ", e.ReportingProvider.ToString());
        Console.Write("stage - {0}, ", e.Stage.ToString());
        Console.WriteLine("work - {0} of {1}", e.CompletedWork, e.TotalWork);
    }
}

static void DestinationCallbacks_ItemConflicting(object sender, ItemConflictingEventArgs e)
{
    Console.Write("Event Item conflicting: source data - {0}, ", e.SourceChangeData != null ? e.SourceChangeData.ToString() : null);
    Console.WriteLine("destination data - {0}", e.DestinationChangeData != null ? e.DestinationChangeData.ToString() : null);
    e.SetResolutionAction(ConflictResolutionAction.Merge);
}

static void DestinationCallbacks_ItemChangeSkipped(object sender, ItemChangeSkippedEventArgs e)
{
    Console.Write("Event Item Change Skipped: provider {0}, ", e.ReportingProvider.ToString());
    Console.Write("stage - {0}, ", e.Stage.ToString());
    Console.WriteLine("item  - {0} ", e.ItemChange.ItemId.ToString());
}

static void DestinationCallbacks_FullEnumerationNeeded(object sender, FullEnumerationNeededEventArgs e)
{
    FullEnumerationAction action = FullEnumerationAction.Full;  // This can be changed by the application to control if full enumeration is FZull, Partial, or Aborted.
    Console.Write("Event Full Enumeration Needed: old action {0}, ", e.Action.ToString());
    Console.WriteLine("new action - {0} ", action.ToString());
    e.Action = action;
}
Private Shared Sub RegisterCallbacks(ByVal provider As Microsoft.Synchronization.SimpleProviders.SimpleSyncProvider)
    AddHandler provider.DestinationCallbacks.FullEnumerationNeeded, AddressOf DestinationCallbacks_FullEnumerationNeeded
    AddHandler provider.DestinationCallbacks.ItemChangeSkipped, AddressOf DestinationCallbacks_ItemChangeSkipped
    AddHandler provider.DestinationCallbacks.ItemConflicting, AddressOf DestinationCallbacks_ItemConflicting
    AddHandler provider.DestinationCallbacks.ProgressChanged, AddressOf DestinationCallbacks_ProgressChanged
End Sub

Private Shared Sub DestinationCallbacks_ProgressChanged(ByVal sender As Object, ByVal e As SyncStagedProgressEventArgs)
    If e.Stage <> SessionProgressStage.ChangeDetection Then
        Console.Write("Event Progress Changed: provider - {0}, ", e.ReportingProvider.ToString())
        Console.Write("stage - {0}, ", e.Stage.ToString())
        Console.WriteLine("work - {0} of {1}", e.CompletedWork, e.TotalWork)
    End If
End Sub

Private Shared Sub DestinationCallbacks_ItemConflicting(ByVal sender As Object, ByVal e As ItemConflictingEventArgs)
    Console.Write("Event Item conflicting: source data - {0}, ", If(e.SourceChangeData IsNot Nothing, e.SourceChangeData.ToString(), Nothing))
    Console.WriteLine("destination data - {0}", If(e.DestinationChangeData IsNot Nothing, e.DestinationChangeData.ToString(), Nothing))
    e.SetResolutionAction(ConflictResolutionAction.Merge)
End Sub

Private Shared Sub DestinationCallbacks_ItemChangeSkipped(ByVal sender As Object, ByVal e As ItemChangeSkippedEventArgs)
    Console.Write("Event Item Change Skipped: provider {0}, ", e.ReportingProvider.ToString())
    Console.Write("stage - {0}, ", e.Stage.ToString())
    Console.WriteLine("item - {0} ", e.ItemChange.ItemId.ToString())
End Sub

Private Shared Sub DestinationCallbacks_FullEnumerationNeeded(ByVal sender As Object, ByVal e As FullEnumerationNeededEventArgs)
    Dim action As FullEnumerationAction = FullEnumerationAction.Full
    ' This can be changed by the application to control if full enumeration is FZull, Partial, or Aborted. 
    Console.Write("Event Full Enumeration Needed: old action {0}, ", e.Action.ToString())
    Console.WriteLine("new action - {0} ", action.ToString())
    e.Action = action
End Sub

참고 항목

참조

SimpleSyncProvider 클래스
SimpleSyncProvider 멤버
Microsoft.Synchronization.SimpleProviders 네임스페이스