From a82ad6994c23ba759f70076e856f1d38500c8bc5 Mon Sep 17 00:00:00 2001 From: AuroraZiling <2935876049@qq.com> Date: Mon, 5 Feb 2024 17:04:38 +0800 Subject: [PATCH] fix: cannot update environment --- src/PipManager/Languages/Lang.Designer.cs | 18 ++++++++++++++++++ src/PipManager/Languages/Lang.resx | 6 ++++++ src/PipManager/Languages/Lang.zh-cn.resx | 6 ++++++ .../Pages/Environment/EnvironmentViewModel.cs | 4 ++-- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/PipManager/Languages/Lang.Designer.cs b/src/PipManager/Languages/Lang.Designer.cs index 020d10b..4871547 100644 --- a/src/PipManager/Languages/Lang.Designer.cs +++ b/src/PipManager/Languages/Lang.Designer.cs @@ -780,6 +780,24 @@ public static string EnvironmentAdd_PythonPath_Title { } } + /// + /// 查找类似 Current: 的本地化字符串。 + /// + public static string EnvironmentCheckEnvironmentUpdate_CurrentVersion { + get { + return ResourceManager.GetString("EnvironmentCheckEnvironmentUpdate_CurrentVersion", resourceCulture); + } + } + + /// + /// 查找类似 Latest: 的本地化字符串。 + /// + public static string EnvironmentCheckEnvironmentUpdate_LatestVersion { + get { + return ResourceManager.GetString("EnvironmentCheckEnvironmentUpdate_LatestVersion", resourceCulture); + } + } + /// /// 查找类似 Pip Manager - Unexpected Exception 的本地化字符串。 /// diff --git a/src/PipManager/Languages/Lang.resx b/src/PipManager/Languages/Lang.resx index 3eaa32c..f702c72 100644 --- a/src/PipManager/Languages/Lang.resx +++ b/src/PipManager/Languages/Lang.resx @@ -670,4 +670,10 @@ Other sources are faster to connect to, but may be incomplete. Timeout + + Current: + + + Latest: + \ 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 ad92978..8dff8f3 100644 --- a/src/PipManager/Languages/Lang.zh-cn.resx +++ b/src/PipManager/Languages/Lang.zh-cn.resx @@ -670,4 +670,10 @@ 查询超时 + + 当前版本: + + + 最新版本: + \ No newline at end of file diff --git a/src/PipManager/ViewModels/Pages/Environment/EnvironmentViewModel.cs b/src/PipManager/ViewModels/Pages/Environment/EnvironmentViewModel.cs index 336c423..7eaca89 100644 --- a/src/PipManager/ViewModels/Pages/Environment/EnvironmentViewModel.cs +++ b/src/PipManager/ViewModels/Pages/Environment/EnvironmentViewModel.cs @@ -111,7 +111,7 @@ private async Task CheckEnvironmentUpdate() await Task.Run(async () => { var versions = await environmentService.GetVersions("pip"); - if (versions.Status != 0) + if (versions.Status == 0) { latest = versions.Versions!.Last(); } @@ -122,7 +122,7 @@ await Task.Run(async () => if (latest != current && latest != string.Empty) { Log.Information($"[Environment] Environment update available ({current} => {latest})"); - var message = $"{Lang.ContentDialog_Message_FindUpdate}\n\n{current} => {latest}"; + var message = $"{Lang.ContentDialog_Message_FindUpdate}\n\n{Lang.EnvironmentCheckEnvironmentUpdate_CurrentVersion}{current}\n{Lang.EnvironmentCheckEnvironmentUpdate_LatestVersion}{latest}"; var result = await contentDialogService.ShowSimpleDialogAsync(ContentDialogCreateOptions.Notice(message)); if (result == ContentDialogResult.Primary) {