コード例 #1
0
        public static async Task SimpleCollectionLoad <T>(this IReactiveList <T> viewModel, GitHubRequest <List <T> > request, Action <Func <Task> > assignMore = null) where T : new()
        {
            if (assignMore == null)
            {
                assignMore = (x) => {}
            }
            ;

            var application = Locator.Current.GetService <ISessionService>();
            var response    = await application.Client.ExecuteAsync(request);

            viewModel.CreateMore(response, assignMore, x => viewModel.AddRange(x));
            viewModel.Reset(response.Data);
        }
    }
コード例 #2
0
        public static Task SimpleCollectionLoad <T>(this IReactiveList <T> viewModel, GitHubRequest <List <T> > request, bool?forceDataRefresh, Action <Func <Task> > assignMore = null) where T : new()
        {
            if (assignMore == null)
            {
                assignMore = (x) => {}
            }
            ;

            return(viewModel.RequestModel(request, forceDataRefresh, response =>
            {
                viewModel.CreateMore(response, assignMore, x =>
                {
                    // This is f*****g broken for iOS because it can't handle estimated rows and the insertions
                    // that ReactiveUI seems to be producing
                    using (viewModel.SuppressChangeNotifications())
                    {
                        viewModel.AddRange(x);
                    }
                });
                viewModel.Reset(response.Data);
            }));
        }
    }