在Blazor中相当于ObserveOnDispatcher

问题描述

在Blazor中,没有单个UI线程,据我所知,没有调度程序。 但是有ComponentBase.InvokeAsync(..)

protected Task InvokeAsync(Action workItem);
protected Task InvokeAsync(Func<Task> workItem);

如何从非UI线程切换到UI线程?

IObservable<int> source ...
source.Throttle(100) // will continue on non UI thread
  .ObserveOnComponent() // how do I write this?
  .ObserveOn(this.InvokeAsync) // or this?
  .Do(this.StateHasChanged); // something that requires UI thread
  .Subscribe();

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)