/// <summary> /// Checks for page. /// </summary> /// <param name="listElement">the list element.</param> /// <returns><c>true</c> if the element contains at least one list item; otherwise <c>false</c>.</returns> private bool CheckForPage(IPropertyData listElement) { while (true) { var item = listElement.GetItemAtIndex(0); if (item != null) { return(true); } this.logger.Debug("List did not contain any elements, waiting..."); return(false); } }
/// <summary> /// Checks for page. /// </summary> /// <param name="listElement">the list element.</param> /// <param name="token">The cancellation token.</param> private void CheckForPage(IPropertyData listElement, CancellationToken token) { while (true) { var item = listElement.GetItemAtIndex(0); if (item != null) { return; } this.logger.Debug("List did not contain any elements, waiting..."); token.WaitHandle.WaitOne(TimeSpan.FromMilliseconds(500)); token.ThrowIfCancellationRequested(); } }
/// <summary> /// Checks the list for correctness. /// </summary> /// <param name="listElement">the list element.</param> /// <param name="token">The cancellation token.</param> /// <param name="numberOfItems"></param> private void CheckList(IPropertyData listElement, CancellationToken token, int numberOfItems) { while (true) { var item = listElement.GetItemAtIndex(numberOfItems - 1); if (item != null) { return; } this.logger.Debug("List did not contain at least {0} elements, waiting...", numberOfItems); token.WaitHandle.WaitOne(TimeSpan.FromMilliseconds(500)); token.ThrowIfCancellationRequested(); } }