- tweak: UI improvement

This commit is contained in:
2025-02-02 10:57:29 +03:00
parent 32fd63c5f3
commit 3c980659be
21 changed files with 283 additions and 83 deletions

View File

@@ -24,6 +24,7 @@ public partial class ServerListViewModel : ViewModelBase, IViewModelPage
[ObservableProperty] private bool _isFavoriteMode;
public ObservableCollection<ServerEntryModelView> Servers { get; }= new();
public ObservableCollection<Exception> HubErrors { get; } = new();
public Action? OnSearchChange;
[GenerateProperty] private HubService HubService { get; }
@@ -40,6 +41,7 @@ public partial class ServerListViewModel : ViewModelBase, IViewModelPage
protected override void InitialiseInDesignMode()
{
ServerViewContainer = new ServerViewContainer(this, RestService, CancellationService, DebugService, ViewHelperService);
HubErrors.Add(new Exception("UVI"));
}
//real think
@@ -51,12 +53,18 @@ public partial class ServerListViewModel : ViewModelBase, IViewModelPage
HubService.HubServerChangedEventArgs += HubServerChangedEventArgs;
HubService.HubServerLoaded += UpdateServerEntries;
HubService.HubServerLoadingError += HubServerLoadingError;
OnSearchChange += OnChangeSearch;
if (!HubService.IsUpdating) UpdateServerEntries();
UpdateFavoriteEntries();
}
private void HubServerLoadingError(Exception obj)
{
HubErrors.Add(obj);
}
private void UpdateServerEntries()
{
Servers.Clear();
@@ -120,6 +128,7 @@ public partial class ServerListViewModel : ViewModelBase, IViewModelPage
public void UpdateRequired()
{
HubErrors.Clear();
Task.Run(HubService.UpdateHub);
}