Browse Source

Refresh on load and add clear selection method

pull/438/head
ionite34 11 months ago
parent
commit
d991f4cd62
No known key found for this signature in database
GPG Key ID: B3404C5F3827849B
  1. 23
      StabilityMatrix.Avalonia/ViewModels/PackageManager/PackageExtensionBrowserViewModel.cs

23
StabilityMatrix.Avalonia/ViewModels/PackageManager/PackageExtensionBrowserViewModel.cs

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Immutable;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Reactive.Linq; using System.Reactive.Linq;
@ -121,13 +122,23 @@ public partial class PackageExtensionBrowserViewModel : ViewModelBase
.Cast<IPackageStep>() .Cast<IPackageStep>()
.ToArray(); .ToArray();
var runner = new PackageModificationRunner { ShowDialogOnStart = true, HideCloseButton = true }; var runner = new PackageModificationRunner { ShowDialogOnStart = true };
EventManager.Instance.OnPackageInstallProgressAdded(runner); EventManager.Instance.OnPackageInstallProgressAdded(runner);
await runner.ExecuteSteps(steps); await runner.ExecuteSteps(steps);
ClearSelection();
}
/// <inheritdoc />
public override async Task OnLoadedAsync()
{
await base.OnLoadedAsync();
await Refresh();
} }
[RelayCommand] [RelayCommand]
private async Task Refresh() public async Task Refresh()
{ {
if (PackagePair is null) if (PackagePair is null)
return; return;
@ -170,6 +181,14 @@ public partial class PackageExtensionBrowserViewModel : ViewModelBase
} }
} }
public void ClearSelection()
{
foreach (var item in SelectedAvailableItems.ToImmutableArray())
{
item.IsSelected = false;
}
}
private void OnSelectedItemsUpdate(Change<SelectableItem<PackageExtension>, string> change) private void OnSelectedItemsUpdate(Change<SelectableItem<PackageExtension>, string> change)
{ {
Debug.WriteLine($"{change}"); Debug.WriteLine($"{change}");

Loading…
Cancel
Save