public WaitForStreamEvent(IEmptyStream stream) { connection = stream.FirstOnly().Listen(() => { finished_ = true; }); }
public void SetInputStream(IEmptyStream stream) { if (inputStreamConnection != null) { inputStreamConnection.Dispose(); } inputStreamConnection = stream.Listen(() => Send()); }
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; })); }
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; })); }
public static IEmptyStream Where(this IEmptyStream stream, Func <bool> o) { return(new AnonymousEmptyStream((Action reaction, Priority p) => { return stream.Listen(() => { if (o()) { reaction(); } }, p); })); }
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; })); }
public static IOnceEmptyStream Once(this IEmptyStream stream) { return(OnceEmptyStream(stream)); }
public static IDisposable LateListen(this IEmptyStream stream, Action action) { return(stream.Listen(action, Priority.Post)); }