Browse Source

Merge pull request #606 from ionite34/go-back-after-install

go back after install
pull/629/head
JT 7 months ago committed by GitHub
parent
commit
d73ca680ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      StabilityMatrix.Avalonia/Services/INavigationService.cs
  2. 3
      StabilityMatrix.Avalonia/Services/NavigationService.cs
  3. 7
      StabilityMatrix.Avalonia/ViewModels/PackageManager/PackageInstallDetailViewModel.cs

1
StabilityMatrix.Avalonia/Services/INavigationService.cs

@ -39,4 +39,5 @@ public interface INavigationService<[SuppressMessage("ReSharper", "UnusedTypePar
bool GoBack(); bool GoBack();
bool CanGoBack { get; } bool CanGoBack { get; }
object? CurrentPageDataContext { get; }
} }

3
StabilityMatrix.Avalonia/Services/NavigationService.cs

@ -1,5 +1,6 @@
using System; using System;
using System.Linq; using System.Linq;
using Avalonia.Controls;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
using FluentAvalonia.UI.Media.Animation; using FluentAvalonia.UI.Media.Animation;
using FluentAvalonia.UI.Navigation; using FluentAvalonia.UI.Navigation;
@ -190,4 +191,6 @@ public class NavigationService<T> : INavigationService<T>
} }
public bool CanGoBack => _frame?.CanGoBack ?? false; public bool CanGoBack => _frame?.CanGoBack ?? false;
public object? CurrentPageDataContext => (_frame?.Content as Control)?.DataContext;
} }

7
StabilityMatrix.Avalonia/ViewModels/PackageManager/PackageInstallDetailViewModel.cs

@ -283,6 +283,13 @@ public partial class PackageInstallDetailViewModel(
if (!runner.Failed) if (!runner.Failed)
{ {
if (ReferenceEquals(this, packageNavigationService.CurrentPageDataContext))
{
packageNavigationService.GoBack();
packageNavigationService.GoBack();
await Task.Delay(100);
}
EventManager.Instance.OnInstalledPackagesChanged(); EventManager.Instance.OnInstalledPackagesChanged();
} }
} }

Loading…
Cancel
Save