You should be doing
Observable.FromEventPattern<string>(cc, "UiAlertMessage")
.ObserveOn(this)
.Subscribe(_ =>
{
AlertControl.Show(this, Language.Title, _.EventArgs.UppercaseFirst());
});
It is the standard way of dispatching to the scheduler related to the specific control. Passing the control schedular as you have done subscribes
on the control rather than observes
on it. See this answer for this difference between ObserverOn
and SubscribeOn
Note the implementation of ObserveOn
is from System..Reactive.Windows.Forms
assembly.
public static IObservable<TSource> ObserveOn<TSource>
(this IObservable<TSource> source, Control control)
{
if (source == null)
throw new ArgumentNullException("source");
if (control == null)
throw new ArgumentNullException("control");
else
return Synchronization.ObserveOn<TSource>(source, (IScheduler) new ControlScheduler(control));
}