<PackageReference Include="System.Reactive" Version="6.0.0-preview.16" />
SkipUntil<TSource>
using System.
Reactive.
Concurrency;
using System.
Reactive.
Disposables;
using System.
Runtime.
CompilerServices;
namespace System.
Reactive.
Linq.
ObservableImpl
{
[
System.
Runtime.
CompilerServices.
NullableContext(
1)]
[
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
0,
1,
1,
1
})]
internal sealed class SkipUntil<[
System.
Runtime.
CompilerServices.
Nullable(
2)]
TSource> :
Producer<
TSource,
SkipUntil<
TSource>.
_>
{
[
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
0,
1
})]
internal sealed class _ :
IdentitySink<
TSource>
{
private bool _open;
private SingleAssignmentDisposableValue _task;
public _(
IObserver<
TSource>
observer)
:
base(
observer)
{
}
public void Run(
SkipUntil<
TSource>
parent)
{
_task.
Disposable =
Scheduler.
ScheduleAction<
_>(
parent.
_scheduler,
this,
parent.
_startTime, (
Action<
_>)
delegate(
_ state) {
state.
Tick();
});
Run(
parent.
_source);
}
protected override void Dispose(
bool disposing)
{
if (
disposing)
_task.
Dispose();
base.
Dispose(
disposing);
}
private void Tick()
{
_open =
true;
}
public override void OnNext(
TSource value)
{
if (
_open)
ForwardOnNext(
value);
}
}
private readonly IObservable<
TSource>
_source;
private readonly DateTimeOffset _startTime;
internal readonly IScheduler _scheduler;
public SkipUntil(
IObservable<
TSource>
source,
DateTimeOffset startTime,
IScheduler scheduler)
{
_source =
source;
_startTime =
startTime;
_scheduler =
scheduler;
}
public IObservable<
TSource>
Combine(
DateTimeOffset startTime)
{
if (
startTime <=
_startTime)
return this;
return new SkipUntil<
TSource>(
_source,
startTime,
_scheduler);
}
[
return:
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
1,
0
})]
protected override _ CreateSink(
IObserver<
TSource>
observer)
{
return new _(
observer);
}
protected override void Run([
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
1,
0
})]
_ sink)
{
sink.
Run(
this);
}
}
}