Beispiel #1
0
        private void WaitForDeletionFromRecycleBin(TimeSpan maxWaitForDeletionFromRecycleBin)
        {
            //At this point we are at a race condition with the server.
            //It can happen that although the status is set to IsInRecycleBin, it can't be removed from there yet.
            //Therefor we have to try again, until it works (or a timeout is reached to avoid infinite loops on errors).
            var timeOutTracker = new TimeOutTracker(maxWaitForDeletionFromRecycleBin);
            do
            {
                DeleteFromRecycleBin();

                try
                {
                    Refresh();
                }
                catch (NoSuchPageException)
                {
                    return;
                }
                if (!Exists)
                {
                    return;
                }
            } while (!timeOutTracker.HasTimedOut);

            throw new PageDeletionException(
                Project.Session.ServerLogin,
                string.Format("Timeout while waiting for remove from recycle bin for page {0}", this));
        }
Beispiel #2
0
        private void WaitUntilPageIsInRecycleBin(TimeSpan maxWaitForDeletionInMs)
        {
            var timeoutTracker = new TimeOutTracker(maxWaitForDeletionInMs);
            do
            {
                try
                {
                    Refresh();
                }
                catch (NoSuchPageException)
                {
                    return;
                }
                if (!Exists || Status == PageState.IsInRecycleBin)
                {
                    return;
                }
            } while (!timeoutTracker.HasTimedOut);

            throw new PageDeletionException(
                Project.Session.ServerLogin,
                string.Format("Timeout while waiting for the page {0} to move into the recycle bin", this));
        }