diff --git a/src/PipManager/Languages/Lang.Designer.cs b/src/PipManager/Languages/Lang.Designer.cs
index e41115f..546e978 100644
--- a/src/PipManager/Languages/Lang.Designer.cs
+++ b/src/PipManager/Languages/Lang.Designer.cs
@@ -1202,6 +1202,15 @@ public static string LibraryDetail_Summary {
}
}
+ ///
+ /// Looks up a localized string similar to Dependency Not Found.
+ ///
+ public static string LibraryDetail_Toast_PackageNotFound {
+ get {
+ return ResourceManager.GetString("LibraryDetail_Toast_PackageNotFound", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Unknown.
///
diff --git a/src/PipManager/Languages/Lang.resx b/src/PipManager/Languages/Lang.resx
index 7855682..b9b0802 100644
--- a/src/PipManager/Languages/Lang.resx
+++ b/src/PipManager/Languages/Lang.resx
@@ -762,4 +762,7 @@
Packages that are in Alpha, Beta, etc. test versions will not be ignored
+
+ Dependency Not Found
+
\ No newline at end of file
diff --git a/src/PipManager/Languages/Lang.zh-cn.resx b/src/PipManager/Languages/Lang.zh-cn.resx
index 8e8f5b5..9bb7e5c 100644
--- a/src/PipManager/Languages/Lang.zh-cn.resx
+++ b/src/PipManager/Languages/Lang.zh-cn.resx
@@ -762,4 +762,7 @@
Alpha、Beta等测试版本的包将不会被忽略
+
+ 未在库中找到该依赖
+
\ No newline at end of file
diff --git a/src/PipManager/ViewModels/Pages/Library/LibraryDetailViewModel.cs b/src/PipManager/ViewModels/Pages/Library/LibraryDetailViewModel.cs
index ac98f47..b5c57ad 100644
--- a/src/PipManager/ViewModels/Pages/Library/LibraryDetailViewModel.cs
+++ b/src/PipManager/ViewModels/Pages/Library/LibraryDetailViewModel.cs
@@ -5,6 +5,9 @@
using System.Collections.ObjectModel;
using PipManager.Services.Environment;
using PipManager.Services.Environment.Response;
+using PipManager.Services.Toast;
+using PipManager.Views.Pages.Library;
+using Wpf.Ui;
using Wpf.Ui.Controls;
namespace PipManager.ViewModels.Pages.Library;
@@ -12,11 +15,14 @@ namespace PipManager.ViewModels.Pages.Library;
public partial class LibraryDetailViewModel : ObservableObject, INavigationAware
{
private readonly IEnvironmentService _environmentService;
- public record LibraryDetailMessage(PackageItem Package);
+ private readonly INavigationService _navigationService;
+ private readonly IToastService _toastService;
+ public record LibraryDetailMessage(PackageItem Package, List Library);
private bool _isInitialized;
[ObservableProperty]
private PackageItem? _package;
+ [ObservableProperty] private List? _library;
#region Contact
@@ -41,9 +47,11 @@ public record LibraryDetailMessage(PackageItem Package);
#endregion Classifier
- public LibraryDetailViewModel(IEnvironmentService environmentService)
+ public LibraryDetailViewModel(IEnvironmentService environmentService, INavigationService navigationService, IToastService toastService)
{
_environmentService = environmentService;
+ _navigationService = navigationService;
+ _toastService = toastService;
WeakReferenceMessenger.Default.Register(this, Receive);
}
@@ -61,11 +69,25 @@ private void InitializeViewModel()
{
_isInitialized = true;
}
+
+ [RelayCommand]
+ private void NavigateToDependency(string name)
+ {
+ var targetPackage = Library!.FirstOrDefault(item => item!.Name == name, null);
+ if (targetPackage is null)
+ {
+ _toastService.Error(Lang.LibraryDetail_Toast_PackageNotFound);
+ return;
+ }
+ _navigationService.NavigateWithHierarchy(typeof(LibraryDetailPage));
+ WeakReferenceMessenger.Default.Send(new LibraryDetailMessage(targetPackage!, Library!));
+ }
private void Receive(object recipient, LibraryDetailMessage message)
{
Package = message.Package;
-
+ Library = message.Library;
+
#region Contact
Author = Package.Author!.Count == 0 ? Lang.LibraryDetail_Unknown : string.Join(", ", Package.Author!);
diff --git a/src/PipManager/ViewModels/Pages/Library/LibraryViewModel.cs b/src/PipManager/ViewModels/Pages/Library/LibraryViewModel.cs
index 2ce3f26..1a4824f 100644
--- a/src/PipManager/ViewModels/Pages/Library/LibraryViewModel.cs
+++ b/src/PipManager/ViewModels/Pages/Library/LibraryViewModel.cs
@@ -162,7 +162,7 @@ private void ToDetailPage(object parameter)
if (_library is null) return;
_navigationService.NavigateWithHierarchy(typeof(LibraryDetailPage));
var current = _library.Where(libraryListItem => libraryListItem.Name == parameter as string).ToList()[0];
- WeakReferenceMessenger.Default.Send(new LibraryDetailMessage(current));
+ WeakReferenceMessenger.Default.Send(new LibraryDetailMessage(current, _library));
Log.Information($"[Library] Turn to detail page: {current.Name}");
}
diff --git a/src/PipManager/Views/Pages/Library/LibraryDetailPage.xaml b/src/PipManager/Views/Pages/Library/LibraryDetailPage.xaml
index 5fbf21e..d4afa6c 100644
--- a/src/PipManager/Views/Pages/Library/LibraryDetailPage.xaml
+++ b/src/PipManager/Views/Pages/Library/LibraryDetailPage.xaml
@@ -105,6 +105,7 @@
+
+