mirror of
https://github.com/AlexMacocian/TrailBlazr.git
synced 2026-07-15 15:20:00 +00:00
RefreshView called on Dispatcher thread
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>0.2.8</Version>
|
||||
<Version>0.2.9</Version>
|
||||
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
||||
@@ -29,6 +29,11 @@ public abstract class ViewModelBase<TViewModel, TView> : INotifyPropertyChanged
|
||||
this.View?.RefreshView();
|
||||
}
|
||||
|
||||
public ValueTask RefreshViewAsync()
|
||||
{
|
||||
return this.View?.RefreshViewAsync() ?? ValueTask.CompletedTask;
|
||||
}
|
||||
|
||||
public void NotifyPropertyChanged(string propertyName)
|
||||
{
|
||||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
|
||||
@@ -54,7 +54,12 @@ public abstract class ViewBase<TView, TViewModel> : ComponentBase
|
||||
|
||||
internal void RefreshView()
|
||||
{
|
||||
this.StateHasChanged();
|
||||
_ = this.InvokeAsync(this.StateHasChanged);
|
||||
}
|
||||
|
||||
internal async ValueTask RefreshViewAsync()
|
||||
{
|
||||
await this.InvokeAsync(this.StateHasChanged);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user