How to use Observable.FromEvent with static events?

泄露秘密 提交于 2019-12-06 04:22:18

I think the problem is your delegate type of your event. Try changing it to:

public static event EventHandler<LoadLanguageSetsCompletedEventArgs> 
    LanguageSetsLoaded = delegate { };

If you look at the signature of Observable.FromEvent that you're trying to use, it looks like this:

public static IObservable<IEvent<TEventArgs>> FromEvent<TEventArgs>(
    Action<EventHandler<TEventArgs>> addHandler,
    Action<EventHandler<TEventArgs>> removeHandler
)
where TEventArgs : EventArgs

Alternatively you could use the overload which has three arguments, the first one being a conversion handler - but I think you'd be better off just changing the event signature if at all possible.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!