Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (日本語) » Mobile Link - クライアント管理 » Mobile Link 用 SQL Anywhere クライアント » dbmlsync 統合コンポーネント (旧式) » dbmlsync 統合コンポーネントのイベント

 

EndSynchronization イベント

EndSynchronization イベントは、同期の完了時にトリガされます。

構文
Public Event EndSynchronization(
  ByVal exitCode As Integer,
  ByRef restart As Boolean
)
Member of DbmlsyncCOM.Dbmlsync
パラメータ

exitCode   0 (ゼロ) 以外の値に設定されている場合は、同期エラーが発生したことを示します。

restart   このイベントが呼び出されるときは、この値は False に設定されます。イベントによって値が True に変更された場合、dbmlsync は同期を再起動します。

備考

このイベントを使用して、同期の完了時にカスタム・アクションを追加します。

次に示す Visual Basic .NET の例は、EndSynchronization イベントを使用して、最大で 5 つの失敗した同期を再起動します。同期の再起動にすべて失敗すると、"All restart attempts failed" というメッセージと、終了コードが出力されます。同期が成功すると、"Synchronization succeeded" というメッセージと、終了コードが出力されます。

' Global variable for the number of restarts
Dim numberOfRestarts As Integer

Private Sub dbmlsync1_EndSynchronization(
 ByVal ExitCode As Integer,
 ByRef restart As Boolean
)
Handles dbmlsync1.EndSynchronization

    If numberOfRestarts < 5 Then
        MsgBox("Restart Number: " + CStr(numberOfRestarts + 1))
        If ExitCode <> 0 Then
            ' restart the failed synchronization
            restart = True
            numberOfRestarts = numberOfRestarts + 1
        Else
            ' the last synchronization succeeded
            MsgBox("Synchronization succeeded. " + _
              "Exit code: " + CStr(ExitCode))
        End If
    Else
        MsgBox("All restart attempts failed. " + _
             "Exit code: " + CStr(ExitCode))
    End If

End Sub