c# - How Can I Unfold This Event to an Observable Sequence? -
i'm trying write add-in outlook, , 1 of events i'm using itemsevents_event.itemchange
- , handler's signature takes object
parameter (the item changed):
items.itemchange += calendaritems_itemchange; private void calendaritems_itemchange(object anitem) {...}
how use observable.fromevent
or observable.fromeventpattern
create observable sequence event "stream" instead of attaching/detaching event usual?
you need use fromevent
conversion overload tell rx how should interpret event:
iobservable<teventargs> fromevent<tdelegate, teventargs>(func<action<teventargs>, tdelegate> conversion, action<tdelegate> addhandler, action<tdelegate> removehandler);
in case like:
var source = observable.fromevent<itemsevents_itemeventchangehandler, object>( emit => new itemsevents_itemeventchangehandler((obj) => emit(obj)), h => items.itemchange += h, h => items.itemchange -= h);
similar answer
Comments
Post a Comment