Azure Xamarin脱机同步 - 多个表/线程

时间:2017-03-26 07:00:51

标签: azure xamarin xamarin.forms synchronization

几个星期了,我试着在Xamarin表单文档中完成TODO项目脱机同步示例,以便为多个表工作,我认为它可能是sqlite的线程问题。

所以在RefreshItems方法中,我现在有3个表要刷新,但它总是失败,甚至没有调试有用的数据...

> private async Task RefreshItems(bool showActivityIndicator, bool
> syncItems, bool isShowToday)
>         {
>             using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator))
>             {
>                 var sf = await managerScheduleFlight.GetScheduleFlightsAsync(syncItems);
>                 
>                 var sc = await managerScheduleCrew.GetScheduleCrewsAsync(syncItems);
> 
>                 var c = await managerCrew.GetCrewsAsync(syncItems);

...

所以在第二次更新

var sc = await managerScheduleCrew.GetScheduleCrewsAsync(syncItems);
它挂了。

1 个答案:

答案 0 :(得分:0)

YES !!!!

建立3个不同的经理是一个错误的错误。加入他们所有的经理解决了所有的问题......

感谢Cheesebaron的提示:)

 private async Task RefreshItems(bool showActivityIndicator, bool syncItems, bool isShowToday)
        {
            using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator))
            {
                var sf = await manager.GetScheduleFlightsAsync(syncItems);

                var sc = await manager.GetScheduleCrewsAsync(syncItems);

                var c = await manager.GetCrewsAsync(syncItems);