Skip to content

Instantly share code, notes, and snippets.

@Yeah69
Yeah69 / SchedulerExtensions.cs
Created May 18, 2018 17:26
MinimalSchedule for IScheduler from Rx
public static class SchedulerExtensions
{
/// <summary>
/// Schedules an action to be executed.
/// </summary>
/// <param name="scheduler">Scheduler to execute the action on.</param>
/// <param name="action">Action to execute.</param>
/// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
/// <exception cref="ArgumentNullException"><paramref name="scheduler"/> or <paramref name="action"/> is <c>null</c>.</exception>
public static IDisposable MinimalSchedule(this IScheduler scheduler, Action action)
@Yeah69
Yeah69 / UsingBFF.DataVirtualizingCollection
Created October 21, 2017 15:05
An example how to use the BFF.DataVirtualizingCollection project
/* IDataVirtualizingCollection<T> implements IList<T>, INotifyPropertyChanged, INotifyCollectionChanged and IDisposable.
Hence, everything you would need to bind to a ItemsSource from a DataGrid, ListBox or other ItemsControls. */
protected IDataVirtualizingCollection<ITitLikeViewModel> CreateDataVirtualizingCollection()
=> CollectionBuilder<ITitLikeViewModel> // A CollectionBuilder creates data virtualizing collections for you.
.CreateBuilder()
/* At the moment, there are three further building functions:
BuildAHoardingSyncCollection(...), BuildAPreloadingAsyncCollection(...), BuildAHoardingAsyncCollection(...).
The async collections need two Scheduler passed to them. A scheduler for the background tasks like the SubscriptionScheduler
below and the DispatcherScheduler like the ObserveScheduler below for UI notifications.
The BasicAccess parameter is crucial for customizing the individual data access in your project.