RefreshView called on Dispatcher thread

This commit is contained in:
2025-08-10 18:01:05 +02:00
parent 9e3f943628
commit 90f937ccd2
3 changed files with 12 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>0.2.8</Version>
<Version>0.2.9</Version>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
+5
View File
@@ -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));
+6 -1
View File
@@ -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);
}
}