Udostępnij za pośrednictwem


ISyncSessionState::OnProgress

Reports synchronization progress to the application.

HRESULT OnProgress(
  SYNC_PROVIDER_ROLE provider,
  SYNC_PROGRESS_STAGE syncStage,
  DWORD dwCompletedWork,
  DWORD dwTotalWork);

Parameters

  • provider
    [in] The role of the provider that is sending this event.
  • syncStage
    [in] The current stage of the synchronization session.
  • dwCompletedWork
    [in] The amount of work that is currently completed in the session. This value is interpreted as being a part of dwTotalWork.
  • dwTotalWork
    [in] The total work for the session.

Return Value

  • S_OK

  • E_INVALIDARG when provider or syncStage is not a valid value.

Remarks

This method can be used to report custom progress to the application. When a provider calls this method, the ISyncCallback::OnProgress event is raised.

When SPS_CHANGE_APPLICATION is specified for syncStage, Sync Framework accumulates the total completed work specified by dwCompletedWork every time that ISyncSessionState::OnProgress is called. Sync Framework also interprets dwTotalWork as the remaining work for the session and calculates the total work for the session by adding dwTotalWork to the accumulated value for completed work. Sync Framework then passes these calculated values to ISyncCallback::OnProgress. When syncStage is any other valid value, dwCompletedWork and dwTotalWork are passed directly to ISyncCallback::OnProgress.

When the source provider specifies work estimates, unexpected results can occur when a provider calls ISyncSessionState::OnProgress and specifies SPS_CHANGE_APPLICATION for syncStage. This is because Sync Framework totals the completed work value every time progress notifications are sent during change application. If a provider sends its own progress notification and specifies SPS_CHANGE_APPLICATION for syncStage, Sync Framework adds the estimated work values that are specified by the provider to the total completed work for the session. This can cause the same work to be counted two times: one time when it is reported by Sync Framework and one time when it is reported by the provider.

See Also

Reference

ISyncSessionState Interface

Concepts

Reporting Synchronization Progress