Responsible for requesting a queue of URIs over HTTP or HTTPS in background.
Inheritance: IDisposable
コード例 #1
0
        public static void WaitForQueueToEmpty(BackgroundHttpRequester requester)
        {
            var time = new Stopwatch();
            time.Start();

            while (requester.QueueCount != 0 && time.Elapsed < timeout)
                Task.Delay(TimeSpan.FromMilliseconds(100)).Wait();
        }
コード例 #2
0
 /// <summary>
 /// Start the requester with any unsent URIs from the last application run.
 /// </summary>
 /// <param name="uploadInterval">How often to send URIs to analytics.</param>
 /// <returns>Task that completes when the requester is ready.</returns>
 private static async Task StartRequesterAsync(TimeSpan uploadInterval)
 {
     requester = new BackgroundHttpRequester(PreprocessHttpRequest);
     var previousRequests = await LocalFolderContractSerializer<List<Uri>>.RestoreAsync(RequestQueueFileName);
     requester.Start(uploadInterval, previousRequests);
 }