Я знаю, что у SL5 есть новое свойство для подсчета MouseClicks, но с помощью я получил это, когда вышел SL4. Теперь я перешел на новую машину, скачал RX, и я понимаю, что RX прошел через несколько изменений, которые сломали этот код. Я пытался, но я не могу перевести переход от FastSubject.
Мне бы очень хотелось полностью понять использование Subject здесь и как обновить вызов для работы с текущей версией Rx.
public static IObservable<TSource> MonitorForDoubleClicks<TSource>(this IObservable<TSource> source, TimeSpan doubleClickSpeed, IScheduler scheduler)
{
return source.Multicast<TSource, TSource, TSource>(
() => new FastSubject<TSource>(),
values =>
{
return values
.TimeInterval(scheduler) //injects a timestamp event arguments
.Skip(1) // in order to determine an interval we need two of these, so this keeps the event in the collection, but does not process the first one in
.Where(interval => interval.Interval <= doubleClickSpeed) //second event has arrived, so we can test the interval
.RemoveTimeInterval() //take the time argument out of the event args
.Take(1) //we take one of the events (the latest) and throw it
.Repeat(); //keep the observer alive forever
});