Exemple #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);
                                }
               });
 }
Exemple #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);
                                }
               });
 }
Exemple #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();
                }
            });
        }
Exemple #4
0
 public void Advise(Lifetime lifetime, Action <R> handler)
 {
     myOriginal.Advise(lifetime, x => handler(myMap(x)));
 }
Exemple #5
0
 public static void Advise(this ISource <Unit> me, Lifetime lifetime, Action handler)
 {
     me.Advise(lifetime, _ => { handler(); });
 }