小编gab*_*ldi的帖子

使用async/await调用WCF服务的模式

我使用基于任务的操作生成了代理.

如何使用async/await 正确调用此服务(处理ServiceClientOperationContext之后)?

我的第一次尝试是:

public async Task<HomeInfo> GetHomeInfoAsync(DateTime timestamp)
{
    using (var helper = new ServiceHelper<ServiceClient, ServiceContract>())
    {
        return await helper.Proxy.GetHomeInfoAsync(timestamp);
    }
}
Run Code Online (Sandbox Code Playgroud)

作为ServiceHelper一个创造ServiceClientOperationContextScope后来处理它们的类:

try
{
    if (_operationContextScope != null)
    {
        _operationContextScope.Dispose();
    }

    if (_serviceClient != null)
    {
        if (_serviceClient.State != CommunicationState.Faulted)
        {
            _serviceClient.Close();
        }
        else
        {
            _serviceClient.Abort();
        }
    }
}
catch (CommunicationException)
{
    _serviceClient.Abort();
}
catch (TimeoutException)
{
    _serviceClient.Abort();
}
catch (Exception)
{
    _serviceClient.Abort();
    throw;
}
finally …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net wcf async-await

59
推荐指数
2
解决办法
5万
查看次数

移动Safari - 输入插入符号不会随着溢出滚动滚动:触摸

我知道Mobile Safari在"动量"(-webkit-overflow-scrolling:touch;)滚动时不会触发事件.但这并不是完全相同的事情,因为Safari在内部处理输入的(闪烁)插入符号.

<div id="container">
    <input type="text" />
    <div class="filling"></div>
</div>

#container {
    position: absolute;
    top: 20px;
    bottom: 20px;
    width: 50%;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    border: 1px solid black;
}

input {
    margin-top: 60vh;
}

.filling {
    height: 200vh;
}
Run Code Online (Sandbox Code Playgroud)

在您的设备上尝试这个小提琴(关注输入然后滚动):https://jsfiddle.net/gabrielmaldi/n5pgedzv

当你按下手指时(即不仅在给动量和释放时)也会发生这个问题:插入符不能滚动.

显然我不想关闭溢出滚动,如果没有办法修复插入符号以便它正确滚动,可以隐藏它.

谢谢

scroll caret mobile-safari touch ios

16
推荐指数
2
解决办法
1万
查看次数

采用ICredentialsProvider的TfsTeamProjectCollectionFactory.GetTeamProjectCollection的替代方案

按照MSDN的方法GetTeamProjectCollection(RegisteredProjectCollection projectCollection, ICredentialsProvider fallbackCredentialsProvider中的TfsTeamProjectCollectionFactory类现在已经过时:

  • "注意:此API现已过时."

  • [ObsoleteAttribute("This method has been deprecated and will be removed in a future release. See GetTeamProjectCollection(RegisteredProjectCollection) instead.", false)]

建议是使用仅占用的重载RegisteredProjectCollection,但是如果我们想要凭证的回退机制,我们应该从现在开始使用什么?

谢谢

.net tfs sdk

9
推荐指数
1
解决办法
5848
查看次数

Android WebView HTML 输入按键不会触发

在某些设备(主要是三星,但也有其他设备)和以下设备的组合上:Android 版本、WebView 版本(即使是 Android 7 中的常青 WebView)和键盘,存在许多问题:

  • keypress 没有被解雇
  • keydown并且keyup总是包含keyCode=229
  • keypress并被input解雇但不包含密钥
  • textInput 没有被解雇
  • maxlengthinput[type=text]用户键入时不支持属性(maxlength允许超过字符,并且仅在提交表单时验证输入)

有没有办法解决这些问题?

javascript java android input webview

4
推荐指数
1
解决办法
2230
查看次数

Haskell - 调用类型类中定义的函数

给出一个类型类:

class AnimalTrainer animal food where
    getFood :: animal -> (food, Int) -- Returns the food and the quantity
    feed :: animal -> (food, Int) -- Returns the leftovers

    feed a = feed' (getFood a) -- Provide a default implementation
        where feed' (f, n) = (f, n - 1)
Run Code Online (Sandbox Code Playgroud)

一个例子:

data Animal = Dog | Cat
data Food = Meat | Milk

instance AnimalTrainer Animal Food where
    getFood Dog = (Meat, 2)
    getFood Cat = (Milk, 3)
Run Code Online (Sandbox Code Playgroud)

如何编写调用类型类中定义的feed函数的另一个函数(在其他地方)?例:

feedEverything :: …
Run Code Online (Sandbox Code Playgroud)

haskell

0
推荐指数
1
解决办法
232
查看次数

标签 统计

.net ×2

android ×1

asp.net ×1

async-await ×1

c# ×1

caret ×1

haskell ×1

input ×1

ios ×1

java ×1

javascript ×1

mobile-safari ×1

scroll ×1

sdk ×1

tfs ×1

touch ×1

wcf ×1

webview ×1