public static Task SimpleCollectionLoad <T>(this CollectionViewModel <T> viewModel, Func <List <T> > request) { return(viewModel.RequestModel(request, response => { //viewModel.CreateMore(response, m => viewModel.MoreItems = m, viewModel.Items.AddRange); viewModel.Items.Reset(response); })); }
public static Task SimpleCollectionLoad <T>(this CollectionViewModel <T> viewModel, Func <BitbucketSharp.Models.V2.Collection <T> > request) { var weakVm = new WeakReference <CollectionViewModel <T> >(viewModel); return(viewModel.RequestModel(request, response => { weakVm.Get()?.CreateMore(response, m => { var weak = weakVm.Get(); if (weak != null) { weak.MoreItems = m; } }, viewModel.Items.AddRange); weakVm.Get()?.Items.Reset(response.Values); })); }
public DeferHelper(CollectionViewModel <TItem> parent) { _parent = parent; }