This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mBraintreeFragment = BraintreeFragment.NewInstance(CrossCurrentActivity.Current.Activity, clientToken); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PayPal.RequestOneTimePayment(mBraintreeFragment, new PayPalRequest($"{amount}")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PayPal.AuthorizeAccount(mBraintreeFragment); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ListView ItemsSource="{Binding RestaurantsGrouped}" | |
GroupDisplayBinding="{Binding Key}" | |
IsGroupingEnabled="True"> | |
... | |
</ListView> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_sourceCache.Connect() | |
.Filter(countryPredicate) | |
.Group(x => x.Category) | |
.Transform(g => new ObservableGroupedCollection<string, Restaurant, string>(g, filterPredicate, sortPredicate)) | |
.Sort(SortExpressionComparer<ObservableGroupedCollection<string, Restaurant, string>>.Ascending(a => a.Key)) | |
.Bind(out _restaurants) | |
.DisposeMany() | |
.Subscribe(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ObservableGroupedCollection<TGroupKey, TObject, TKey> : ObservableCollectionExtended<TObject>, IDisposable | |
{ | |
public TGroupKey Key { get; } | |
public ObservableGroupedCollection(IGroup<TObject, TKey, TGroupKey> group, IObservable<Func<TObject, bool>> filter, IObservable<IComparer<TObject>> comparer) | |
{ | |
this.Key = group.Key; | |
//load and sort the grouped list | |
var dataLoader = group.Cache.Connect() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ReadOnlyObservableCollection<ObservableGroupedCollection<string, Restaurant, string>> RestaurantsGrouped => _restaurants; | |
private readonly ReadOnlyObservableCollection<ObservableGroupedCollection<string, Restaurant, string>> _restaurants; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_sourceCache.Connect() | |
.RefCount() | |
.Filter(countryPredicate) | |
.Filter(filterPredicate) | |
.Sort(sortPredicate) | |
.Bind(out _restaurants) | |
.DisposeMany() | |
.Subscribe(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sortPredicate = this.WhenAnyValue(x => x.SortBy) | |
.Select(x => x == "Type" ? SortExpressionComparer<Restaurant>.Ascending(a => a.Type) : SortExpressionComparer<Restaurant>.Ascending(a => a.Name)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace DynamicDataGroupingSample | |
{ | |
public class MainViewModel : ReactiveObject, IDisposable | |
{ | |
public MainViewModel() | |
{ | |
SortCommand = ReactiveCommand.CreateFromTask(ExecuteSort); | |
} | |
private async Task ExecuteSort() | |
{ |