在iOS中,当根节点为a时键盘出现时,Xamarin.Forms会调整屏幕大小ScrollView
.但是当根节点不是ScrollView
键盘时,隐藏了UI的一部分.你如何防止这种情况发生?
我正在尝试构建重试,HttpClient
DelegatingHandler
以便将诸如503 Server Unavailable
和超时之类的响应视为瞬态故障并自动重试.
我从http://blog.devscrum.net/2014/05/building-a-transient-retry-handler-for-the-net-httpclient/的代码开始,该代码适用于该403 Server Unavailable
案例,但不处理超时作为短暂的失败.不过,我喜欢使用Microsoft瞬态故障处理块来处理重试逻辑的一般想法.
这是我目前的代码.它使用自定义Exception
子类:
public class HttpRequestExceptionWithStatus : HttpRequestException {
public HttpRequestExceptionWithStatus(string message) : base(message)
{
}
public HttpRequestExceptionWithStatus(string message, Exception inner) : base(message, inner)
{
}
public HttpStatusCode StatusCode { get; set; }
public int CurrentRetryCount { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
这里是瞬态故障检测器类:
public class HttpTransientErrorDetectionStrategy : ITransientErrorDetectionStrategy {
public bool IsTransient(Exception ex)
{
var cex = ex as HttpRequestExceptionWithStatus;
var isTransient = cex != null …
Run Code Online (Sandbox Code Playgroud)