(this, Receive);
}
@@ -72,17 +78,21 @@ public void OnNavigatedTo()
_navigationService.GetNavigationControl().BreadcrumbBar!.Visibility = Visibility.Collapsed;
switch (_themeService.GetTheme())
{
- case Wpf.Ui.Appearance.ApplicationTheme.Light:
+ case ApplicationTheme.Light:
_themeType = "light";
ThemeTypeInHex = "#FFFFFF";
_themeTypeInInteger = 16777215;
break;
- case Wpf.Ui.Appearance.ApplicationTheme.Dark:
+ case ApplicationTheme.Dark:
_themeType = "dark";
ThemeTypeInHex = "#0D1117";
_themeTypeInInteger = 856343;
break;
+ case ApplicationTheme.Unknown:
+ case ApplicationTheme.HighContrast:
+ default:
+ throw new ArgumentOutOfRangeException();
}
SearchDetailPage.ProjectDescriptionWebView!.DefaultBackgroundColor = Color.FromArgb(_themeTypeInInteger);
}
@@ -103,6 +113,27 @@ private void InitializeViewModel()
[ObservableProperty]
private string _targetVersion = "";
+ [RelayCommand]
+ private void DownloadPackage()
+ {
+ var openFolderDialog = new OpenFolderDialog
+ {
+ Title = Lang.Dialog_Title_DownloadDistributions
+ };
+ var result = openFolderDialog.ShowDialog();
+ if (result != true)
+ {
+ return;
+ }
+ _actionService.AddOperation(new ActionListItem
+ (
+ ActionType.Download,
+ [$"{Package!.Name}=={TargetVersion}"],
+ path: openFolderDialog.FolderName,
+ extraParameters: ["--no-deps"]
+ ));
+ }
+
[RelayCommand]
private async Task InstallPackage()
{
@@ -115,10 +146,16 @@ private async Task InstallPackage()
if (installedPackages.Any(item => item.Name == Package!.Name))
{
_toastService.Error(Lang.LibraryInstall_Add_AlreadyInstalled);
+ return;
}
+ _actionService.AddOperation(new ActionListItem
+ (
+ ActionType.Install,
+ [$"{Package!.Name}=={TargetVersion}"]
+ ));
}
- public void Receive(object recipient, SearchDetailMessage message)
+ private void Receive(object recipient, SearchDetailMessage message)
{
Package = message.Package;
@@ -149,7 +186,7 @@ public void Receive(object recipient, SearchDetailMessage message)
var html = await _httpClient.GetStringAsync(projectDescriptionUrl);
var htmlDocument = new HtmlDocument();
htmlDocument.LoadHtml(html);
- string projectDescriptionHtml = string.Format(_htmlModel, _themeType, ThemeTypeInHex, htmlDocument.DocumentNode.SelectSingleNode("//*[@id=\"description\"]/div").InnerHtml);
+ string projectDescriptionHtml = string.Format(HtmlModel, _themeType, ThemeTypeInHex, htmlDocument.DocumentNode.SelectSingleNode("//*[@id=\"description\"]/div").InnerHtml);
SearchDetailPage.ProjectDescriptionWebView.CoreWebView2.Profile.PreferredColorScheme = CoreWebView2PreferredColorScheme.Dark;
SearchDetailPage.ProjectDescriptionWebView.NavigateToString(projectDescriptionHtml);
@@ -158,7 +195,7 @@ public void Receive(object recipient, SearchDetailMessage message)
{
Log.Error(ex.Message);
_toastService.Error(Lang.SearchDetail_ProjectDescription_LoadFailed);
- string projectDescriptionHtml = string.Format(_htmlModel, _themeType, ThemeTypeInHex, $"{Lang.SearchDetail_ProjectDescription_LoadFailed}
");
+ string projectDescriptionHtml = string.Format(HtmlModel, _themeType, ThemeTypeInHex, $"{Lang.SearchDetail_ProjectDescription_LoadFailed}
");
SearchDetailPage.ProjectDescriptionWebView.CoreWebView2.Profile.PreferredColorScheme = CoreWebView2PreferredColorScheme.Dark;
SearchDetailPage.ProjectDescriptionWebView.NavigateToString(projectDescriptionHtml);
diff --git a/src/PipManager/ViewModels/Pages/Search/SearchViewModel.cs b/src/PipManager/ViewModels/Pages/Search/SearchViewModel.cs
index d16c340..2361be0 100644
--- a/src/PipManager/ViewModels/Pages/Search/SearchViewModel.cs
+++ b/src/PipManager/ViewModels/Pages/Search/SearchViewModel.cs
@@ -74,7 +74,7 @@ private void ToDetailPage(object parameter)
#endregion Details
[RelayCommand]
- public async Task ToPreviousPage()
+ private async Task ToPreviousPage()
{
if (CurrentPage == 1)
{
@@ -89,7 +89,7 @@ public async Task ToPreviousPage()
}
[RelayCommand]
- public async Task ToNextPage()
+ private async Task ToNextPage()
{
if (CurrentPage == MaxPage)
{
@@ -113,12 +113,9 @@ private void Process(QueryWrapper queryWrapper)
{
if (queryWrapper.Status == QueryStatus.Success)
{
- foreach (var resultItem in queryWrapper.Results!)
+ foreach (var resultItem in queryWrapper.Results!.Where(resultItem => string.IsNullOrEmpty(resultItem.Description)))
{
- if (string.IsNullOrEmpty(resultItem.Description))
- {
- resultItem.Description = Lang.Search_List_NoDescription;
- }
+ resultItem.Description = Lang.Search_List_NoDescription;
}
QueryList = new ObservableCollection(queryWrapper.Results!);
TotalResultNumber = queryWrapper.ResultCount!;
@@ -128,13 +125,18 @@ private void Process(QueryWrapper queryWrapper)
}
else
{
- if (queryWrapper.Status == QueryStatus.NoResults)
+ switch (queryWrapper.Status)
{
- toastService.Error(Lang.Search_Query_NoResults);
- }
- else if (queryWrapper.Status == QueryStatus.Timeout)
- {
- toastService.Error(Lang.Search_Query_Timeout);
+ case QueryStatus.NoResults:
+ toastService.Error(Lang.Search_Query_NoResults);
+ break;
+ case QueryStatus.Timeout:
+ toastService.Error(Lang.Search_Query_Timeout);
+ break;
+ case QueryStatus.Success:
+ break;
+ default:
+ throw new ArgumentOutOfRangeException();
}
QueryList.Clear();
TotalResultNumber = "";
@@ -144,7 +146,7 @@ private void Process(QueryWrapper queryWrapper)
}
[RelayCommand]
- public async Task Search(string? parameter)
+ private async Task Search(string? parameter)
{
if (parameter != null && !string.IsNullOrEmpty(parameter))
{
diff --git a/src/PipManager/Views/Pages/Action/ActionPage.xaml b/src/PipManager/Views/Pages/Action/ActionPage.xaml
index 171afa9..beca245 100644
--- a/src/PipManager/Views/Pages/Action/ActionPage.xaml
+++ b/src/PipManager/Views/Pages/Action/ActionPage.xaml
@@ -1,25 +1,25 @@
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
@@ -34,74 +34,81 @@
Icon="{ui:SymbolIcon Bug24}" />
+ ItemsSource="{Binding ViewModel.Actions.AsObservable}"
+ x:Name="ActionList">
-
+
-
+
-
+
+ Text="{Binding OperationDescription}"
+ VerticalAlignment="Center" />
+ VerticalAlignment="Center">
+ Value="{Binding ProgressBarValue, Mode=OneWay}"
+ Width="300" />
-
+
+ TextWrapping="WrapWithOverflow"
+ VerticalAlignment="Center" />
-
+
+ Margin="5,0,0,0"
+ Text="{Binding OperationStatus}"
+ VerticalAlignment="Center" />
@@ -116,15 +123,18 @@
Grid.Column="1"
Margin="0,5,0,0"
Style="{StaticResource BodyLargeTextBlockStyle}"
- Text="Console Output" />
+ Text="{I18N {x:Static lang:LangKeys.Action_ConsoleOutput}}" />
+ MaxHeight="220"
+ Text="{Binding ConsoleOutput}"
+ x:Name="ActionConsoleOutputTextbox">
-
+
@@ -136,8 +146,8 @@
diff --git a/src/PipManager/Views/Pages/Lab/LabPage.xaml b/src/PipManager/Views/Pages/Lab/LabPage.xaml
index c91aa61..09b4493 100644
--- a/src/PipManager/Views/Pages/Lab/LabPage.xaml
+++ b/src/PipManager/Views/Pages/Lab/LabPage.xaml
@@ -18,6 +18,5 @@
mc:Ignorable="d">
-
\ No newline at end of file
diff --git a/src/PipManager/Views/Pages/Library/LibraryDetailPage.xaml b/src/PipManager/Views/Pages/Library/LibraryDetailPage.xaml
index a57af06..4029612 100644
--- a/src/PipManager/Views/Pages/Library/LibraryDetailPage.xaml
+++ b/src/PipManager/Views/Pages/Library/LibraryDetailPage.xaml
@@ -1,4 +1,5 @@
-
+
+ Visibility="{Binding ViewModel.LibraryList, Converter={StaticResource NotNullToVisibility}}">
@@ -74,7 +74,7 @@
BorderThickness="1"
CornerRadius="5"
Margin="0,0,5,0"
- Visibility="{Binding ViewModel.ListVisible, Converter={StaticResource InverseBoolToVisibility}}">
+ Visibility="{Binding ViewModel.LibraryList, Converter={StaticResource NotNullToVisibility}}">
@@ -93,21 +93,21 @@