WaitForChanges Method

Waits a certain amount of time for changes to occur.

Syntax

bool WaitForChanges(int iTimeout);

Remarks

This method blocks for Timeout seconds, waiting for changes to occur within the scope represented by the current NextChangeMarker (which must already be populated). If any changes occur, returns true; otherwise returns false.

Timeout must be a value between 30 and 480 seconds (inclusive). Note that Dropbox also adds 90 seconds of random jitter to this value. This method may return early if changes occur before the total timeout expires.

If this method returns true, use ListChanges to retrieve the changes.

Note that this method will automatically change the value of Timeout property as necessary when called; and will restore the original value before returning.

// Get the baseline state first.
Dropbox dropbox = new Dropbox();

dropbox.ListChanges("");
do {
  // Continue to call ListChanges() until ChangeMarker is the empty string (indicating there
  // are no more changes to list).
  dropbox.ListChanges("");
} while (dropbox.ChangeMarker.Length > 0);

for (int i = 0; i < dropbox.Resources.Count; i++) {
  // Apply the baseline state.
}

// Now NextChangeMarker will be populated. If we were to call ListChanges() again right now,
// nothing would be listed and NextChangeMarker would still be populated.

// Wait at least 2 minutes for changes to occur. Assume something changes while we wait.
dropbox.WaitForChanges(120); // (Note that this is a blocking call.)

dropbox.ListChanges("");
do {
  dropbox.ListChanges("");
} while (dropbox.ChangeMarker.Length > 0);

for (int i = 0; i < dropbox.Resources.Count; i++) {
  // Apply the changes.
}

Error Handling

This method returns a Boolean value; after it returns, call the GetLastErrorCode() method to obtain its result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Cloud 2020 Qt Edition - Version 20.0 [Build 8265]