我在mvvmcross viewmodel中有一个长时间运行的进程,并希望将其设置为异步(http://msdn.microsoft.com/en-us/library/vstudio/hh191443.aspx).
Xamarin的测试版渠道目前支持async关键字.
下面是我目前如何实现异步的示例.IsBusy标志可以绑定到UI元素并显示加载消息.
这是正确的方法吗?
public class MyModel: MvxViewModel
{
private readonly IMyService _myService;
private bool _isBusy;
public bool IsBusy
{
get { return _isBusy; }
set { _isBusy = value; RaisePropertyChanged(() => IsBusy); ; }
}
public ICommand MyCommand
{
get
{
return new MvxCommand(DoMyCommand);
}
}
public MyModel(IMyService myService)
{
_myService = myService;
}
public async void DoMyCommand()
{
IsBusy = true;
await Task.Factory.StartNew(() =>
{
_myService.LongRunningProcess();
});
IsBusy = false;
}
}
Run Code Online (Sandbox Code Playgroud) 当我收到错误时,我无法构建引用MvvmCross的Xamarin项目:
错误MT3001:无法AOT程序集'/ Users/chriskoiak/Documents/Initial/Mobile Clients/xxxx/obj/iPhone/Debug/mtouch-cache/Build/Cirrious.CrossCore.dll'(MT3001)错误MT3001:无法AOT程序集'/ Users/chriskoiak/Documents/Initial/Mobile Clients/xxxx/obj/iPhone/Debug/mtouch-cache/Build/Cirrious.MvvmCross.dll'(MT3001)
我升级到xcode5后出现此错误,mvvmcross 3.0.12 Xamarin.iOS 7.0.0.11
有没有其他人遇到此问题或可以建议修复?
谢谢
是否可以通过在 Elasticsearch 查询中搜索子文档来返回父数据?
我有两种文档类型,例如书籍和章节,它们作为父/子(非嵌套)相关。
我想对子文档运行搜索并返回子文档以及父文档中的一些字段。我试图避免对父级执行单独的查询。
更新
我能找到的唯一方法是使用has_child查询,然后使用一系列聚合来钻回子级并再次应用查询/过滤器。然而,这似乎过于复杂且效率低下。
GET index/_search
{
"size": 10,
"query": {
"has_child": {
"type": "chapter",
"query": {
"term": {
"field": "value"
}
}
}
},
"aggs": {
"name1": {
"terms": {
"size": 50,
"field": "id"
},
"aggs": {
"name2": {
"top_hits": {
"size": 50
}
},
"name3": {
"children": {
"type": "type2"
},
"aggs": {
"docFilter": {
"filter": {
"query": {
"match": {
"_all": "value"
}
}
},
"aggs": {
"docs": {
"top_hits": {
"size": …Run Code Online (Sandbox Code Playgroud)