Exemplo n.º 1
0
 public static void AdviseNotNull <T>(this ISource <T> me, Lifetime lifetime, Action <T> handler) where T : class
 {
     me.Advise(lifetime, v => { if (v != null)
                                {
                                    handler(v);
                                }
               });
 }
Exemplo n.º 2
0
 public static void AdviseNotNull <T>(this ISource <T?> me, Lifetime lifetime, Action <T> handler) where T : struct
 {
     me.Advise(lifetime, v => { if (v != null)
                                {
                                    handler(v.Value);
                                }
               });
 }
Exemplo n.º 3
0
        public static void AdviseUntil <T>(this ISource <T> me, Lifetime lifetime, Func <T, bool> handler)
        {
            if (!lifetime.IsAlive)
            {
                return;
            }

            var definition = Lifetime.Define(lifetime);

            me.Advise(definition.Lifetime, v =>
            {
                if (handler(v))
                {
                    definition.Terminate();
                }
            });
        }
Exemplo n.º 4
0
 public void Advise(Lifetime lifetime, Action <R> handler)
 {
     myOriginal.Advise(lifetime, x => handler(myMap(x)));
 }
Exemplo n.º 5
0
 public static void Advise(this ISource <Unit> me, Lifetime lifetime, Action handler)
 {
     me.Advise(lifetime, _ => { handler(); });
 }