Exemple #1
0
 public WaitForStreamEvent(IEmptyStream stream)
 {
     connection = stream.FirstOnly().Listen(() =>
     {
         finished_ = true;
     });
 }
Exemple #2
0
 public void SetInputStream(IEmptyStream stream)
 {
     if (inputStreamConnection != null)
     {
         inputStreamConnection.Dispose();
     }
     inputStreamConnection = stream.Listen(() => Send());
 }
Exemple #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;
     }));
 }
Exemple #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;
     }));
 }
Exemple #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);
     }));
 }
Exemple #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;
        }));
    }
Exemple #7
0
 public static IOnceEmptyStream Once(this IEmptyStream stream)
 {
     return(OnceEmptyStream(stream));
 }
Exemple #8
0
 public static IDisposable LateListen(this IEmptyStream stream, Action action)
 {
     return(stream.Listen(action, Priority.Post));
 }