我有以下代码:
ProgressMessageHandler progress = new ProgressMessageHandler();
progress.HttpSendProgress += new EventHandler<HttpProgressEventArgs>(HttpSendProgress);
HttpRequestMessage message = new HttpRequestMessage();
message.Method = HttpMethod.Post;
message.Content = content;
message.RequestUri = new Uri("http://myaddress");
var client = HttpClientFactory.Create(progress);
sending = client.SendAsync(message);
private void HttpSendProgress(object sender, HttpProgressEventArgs e)
{
//....
}
当“myaddress”不可用时,我想了解情况。进度处于活动状态时会调用方法 HttpSendProgress,因此,我无法签入此方法。任何检查“myaddress”是否可用的方法。我想再启动一个线程来检查上次调用 HttpSendProgress 的时间。但也许有一个标准的方法?