我有一个将在Parallel.Foreach中使用的异步方法.在异步方法中有等待任务.但是,在测试中,似乎没有等待行为,await Task没有完成.有什么问题?下面是代码.
public void method1()
{
Ilist<string> testList = new IList<string>(){"1","2","3"};
Parallel.ForEach(testList, ()=>
{
method2();
});
}
public async void method2()
{
await Task.run(()=>{ some other codes here });
}
Run Code Online (Sandbox Code Playgroud) 我们知道,extjs4提供了一个网格内置检查列,但似乎这种类型只能绑定特殊的bool类型.我的要求只是想在网格中显示一个复选框,不想绑定到任何字段.
我怎样才能做到这一点?
谢谢
我有一个像下面这样的指令,基本上用当前的一个附加一个新元素.并在新元素绑定ng-controller"openCntl"
explorerModule.controller("openCntl",function($scope, $dialog){
$scope.open = function(){
alert('dialog closed with result: ' + result);
};
});
explorerModule.directive('ngCustomerClick', function($parse){
return {
controller : "openCntl",
link: function(scope, element, attr){
var alert = angular.element(
'<div class="lp-dropdown-wrapper open" ng-controller="dialogCntl" ' +
'><div class="arrow"></div>' +
'<ul class="nav nav-tabs" style="display: inline;">' +
'<li class="add" ng-click="open()"><a tabindex="-1" href="#"><span class="icon-coffee"></span>Add</a></li>'+
'</ul></div>'
);
}
}
});
Run Code Online (Sandbox Code Playgroud)
但是当我点击li时,不要在控制器"openCntl"中调用该函数,如何实现呢?
非常感谢