예제 #1
0
파일: Stream.cs 프로젝트: AlexSergPosp/Test
 public WaitForStreamEvent(IEmptyStream stream)
 {
     connection = stream.FirstOnly().Listen(() =>
     {
         finished_ = true;
     });
 }
예제 #2
0
파일: Stream.cs 프로젝트: AlexSergPosp/Test
 public void SetInputStream(IEmptyStream stream)
 {
     if (inputStreamConnection != null)
     {
         inputStreamConnection.Dispose();
     }
     inputStreamConnection = stream.Listen(() => Send());
 }
예제 #3
0
파일: Stream.cs 프로젝트: AlexSergPosp/Test
 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;
     }));
 }
예제 #4
0
파일: Stream.cs 프로젝트: AlexSergPosp/Test
 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;
     }));
 }
예제 #5
0
파일: Stream.cs 프로젝트: AlexSergPosp/Test
 public static IEmptyStream Where(this IEmptyStream stream, Func <bool> o)
 {
     return(new AnonymousEmptyStream((Action reaction, Priority p) =>
     {
         return stream.Listen(() =>
         {
             if (o())
             {
                 reaction();
             }
         }, p);
     }));
 }
예제 #6
0
파일: Stream.cs 프로젝트: AlexSergPosp/Test
    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;
        }));
    }
예제 #7
0
파일: Stream.cs 프로젝트: AlexSergPosp/Test
 public static IOnceEmptyStream Once(this IEmptyStream stream)
 {
     return(OnceEmptyStream(stream));
 }
예제 #8
0
파일: Stream.cs 프로젝트: AlexSergPosp/Test
 public static IDisposable LateListen(this IEmptyStream stream, Action action)
 {
     return(stream.Listen(action, Priority.Post));
 }