Condividi tramite


Classe SyncOperationStatistics

Rappresenta le statistiche su una sessione di sincronizzazione bidirezionale.

Spazio dei nomi: Microsoft.Synchronization
Assembly: Microsoft.Synchronization (in microsoft.synchronization.dll)

Sintassi

'Dichiarazione
<SerializableAttribute> _
Public Class SyncOperationStatistics
'Utilizzo
Dim instance As SyncOperationStatistics
[SerializableAttribute] 
public class SyncOperationStatistics
[SerializableAttribute] 
public ref class SyncOperationStatistics
/** @attribute SerializableAttribute() */ 
public class SyncOperationStatistics
SerializableAttribute 
public class SyncOperationStatistics

Esempio

Nell'esempio seguente si sincronizzano i dati tra due provider e si consente all'utente di visualizzare le statistiche della sincronizzazione.

    ' Create the synchronization orchestrator and set the providers and synchronization direction.
    Dim orchestrator As New SyncOrchestrator()
    orchestrator.LocalProvider = localProvider
    orchestrator.RemoteProvider = remoteProvider
    orchestrator.Direction = syncDir

    Dim msg As String
    Try
        ' Synchronize data between the two providers.
        Dim stats As SyncOperationStatistics = orchestrator.Synchronize()

        ' Display statistics for the synchronization operation.
        msg = ((("Synchronization succeeded!" & vbLf & vbLf & stats.DownloadChangesApplied & " download changes applied" & vbLf) & stats.DownloadChangesFailed & " download changes failed" & vbLf) & stats.UploadChangesApplied & " upload changes applied" & vbLf) & stats.UploadChangesFailed & " upload changes failed"
    Catch ex As Exception
        msg = "Synchronization failed! Here's why: " & vbLf & vbLf & ex.Message
    End Try
    MessageBox.Show(msg, "Synchronization Results")
End Sub
    // Create the synchronization orchestrator and set the providers and synchronization direction.
    SyncOrchestrator orchestrator = new SyncOrchestrator();
    orchestrator.LocalProvider = localProvider;
    orchestrator.RemoteProvider = remoteProvider;
    orchestrator.Direction = syncDir;

    string msg;
    try
    {
        // Synchronize data between the two providers.
        SyncOperationStatistics stats = orchestrator.Synchronize();

        // Display statistics for the synchronization operation.
        msg = "Synchronization succeeded!\n\n" +
            stats.DownloadChangesApplied + " download changes applied\n" +
            stats.DownloadChangesFailed + " download changes failed\n" +
            stats.UploadChangesApplied + " upload changes applied\n" +
            stats.UploadChangesFailed + " upload changes failed";
    }
    catch (Exception ex)
    {
        msg = "Synchronization failed! Here's why: \n\n" + ex.Message;
    }
    MessageBox.Show(msg, "Synchronization Results");
}

Gerarchia di ereditarietà

System.Object
  Microsoft.Synchronization.SyncOperationStatistics

Thread Safety

Tutti i membri statici pubblici (Shared in Visual Basic) di questo tipo sono thread safe. I membri di istanza non hanno garanzia di essere thread safe.

Vedere anche

Riferimento

Membri SyncOperationStatistics
Spazio dei nomi Microsoft.Synchronization