public static IDisposable BindTo <T>(this IObservable <CollectionAddRemoveEvent <T> > This, ListControl listControl) =>
 This.Subscribe(x =>
 {
     if (x.IsAdded)
     {
         listControl.Add(x.Value).SubscribeAndForget();
     }
     else
     {
         listControl.Remove(x.Value);
     }
 });
示例#2
0
 public static void Bind <T>(this IBinder This, IObservable <CollectionAddRemoveEvent <T> > source, ListControl target)
 {
     if (target != null)
     {
         source
         .Subscribe(x =>
         {
             if (x.IsAdded)
             {
                 target.Add(x.Value).SubscribeAndForget();
             }
             else
             {
                 target.Remove(x.Value);
             }
         })
         .AddTo(This);
     }
 }