Exemplo n.º 1
0
 public WaitForStreamEvent(IEmptyStream stream)
 {
     connection = stream.FirstOnly().Listen(() =>
     {
         finished_ = true;
     });
 }
Exemplo n.º 2
0
 public void SetInputStream(IEmptyStream stream)
 {
     if (inputStreamConnection != null)
     {
         inputStreamConnection.Dispose();
     }
     inputStreamConnection = stream.Listen(() => Send());
 }
Exemplo n.º 3
0
 public static IEmptyStream FirstOnly(this IEmptyStream stream)
 {
     return(new AnonymousEmptyStream((Action reaction, Priority p) =>
     {
         SingleAssignmentDisposable disp = new SingleAssignmentDisposable();
         disp.Disposable = stream.Listen(() =>
         {
             reaction();
             disp.Dispose();
         }, p);
         return disp;
     }));
 }
Exemplo n.º 4
0
 private static IOnceEmptyStream OnceEmptyStream(IEmptyStream stream)
 {
     return(new AnonymousEmptyStream((Action reaction, Priority p) =>
     {
         SingleAssignmentDisposable disp = new SingleAssignmentDisposable();
         disp.Disposable = stream.Listen(() =>
         {
             reaction();
             disp.Dispose();
         }, p);
         return disp;
     }));
 }
Exemplo n.º 5
0
 public static IEmptyStream Where(this IEmptyStream stream, Func <bool> o)
 {
     return(new AnonymousEmptyStream((Action reaction, Priority p) =>
     {
         return stream.Listen(() =>
         {
             if (o())
             {
                 reaction();
             }
         }, p);
     }));
 }
Exemplo n.º 6
0
    public static IEmptyStream MergeWith(this IEmptyStream stream, params IEmptyStream[] others)
    {
        return(new AnonymousEmptyStream((reaction, p) =>
        {
            ListDisposable disp = new ListDisposable();
            disp.Add(stream.Listen(reaction, p));

            foreach (var other in others)
            {
                disp.Add(other.Listen(reaction, p));
            }

            return disp;
        }));
    }
Exemplo n.º 7
0
 public static IOnceEmptyStream Once(this IEmptyStream stream)
 {
     return(OnceEmptyStream(stream));
 }
Exemplo n.º 8
0
 public static IDisposable LateListen(this IEmptyStream stream, Action action)
 {
     return(stream.Listen(action, Priority.Post));
 }