Closed djonasdev closed 1 year ago
Hello. thank you for your suggestion.
I have no intention to do so at the present. Because by doing so, the library has dependency to the Reactive Extensions.
I have ever used the library with Reactive Extensions. I introduce you code snippet that adds Rx version of GetBitmap() to the library.
using System.Reactive.Linq;
public static class CameraRx
{
public static IObservable<Bitmap> BitmapRx(this Camera camera, double millisecond)
{
return Observable.Interval(TimeSpan.FromMilliseconds(millisecond))
.ObserveOn(System.Threading.SynchronizationContext.Current)
.Select(x => camera.GetBitmap())
.Where(x => x != null)
.Publish().RefCount(); // cold to hot.
}
}
Since the use of events is rather an outdated technique, I would be happy if you would also implement the
IObservable
pattern in your library.This would make it more than easy to use your library in conjunction with system.reactive. 🍻