GZUpdate.Client.WPF
26.101.1005
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Framework 4.7.2
This package targets .NET Framework 4.7.2. The package is compatible with this framework or higher.
dotnet add package GZUpdate.Client.WPF --version 26.101.1005
NuGet\Install-Package GZUpdate.Client.WPF -Version 26.101.1005
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GZUpdate.Client.WPF" Version="26.101.1005" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GZUpdate.Client.WPF" Version="26.101.1005" />
<PackageReference Include="GZUpdate.Client.WPF" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GZUpdate.Client.WPF --version 26.101.1005
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: GZUpdate.Client.WPF, 26.101.1005"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GZUpdate.Client.WPF@26.101.1005
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GZUpdate.Client.WPF&version=26.101.1005
#tool nuget:?package=GZUpdate.Client.WPF&version=26.101.1005
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
GZUpdate.Client.WPF
GZUpdate.Client.WPF 是 GZUpdate.Client 的 WPF 开箱即用集成包。它封装了更新检查、默认升级进度窗口、启动阶段自动重启,以及手动检查升级时的确认流程。
安装
<PackageReference Include="GZUpdate.Client.WPF" Version="26.101.1004" />
启动时自动检查并升级
在 App.xaml.cs 的 OnStartup 中,于创建主窗口之前调用:
using System.Windows;
using GZUpdate.Client;
using GZUpdate.Client.WPF;
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
WpfUpdateClient.Configure(
server: "https://update.infnitee.com/",
productId: "YourProductId",
versionType: EnumVersionType.release,
upgradeExecutorDllPath: "__upgrade_executor_dll");
var result = WpfUpdateClient.CheckAndUpdate();
if (result.ShouldExitApplication)
return;
var mainWindow = new MainWindow();
MainWindow = mainWindow;
mainWindow.Show();
}
启动模式下,发现新版本后会显示默认升级进度窗口。升级完成后默认启动新实例,调用方应根据 ShouldExitApplication 停止继续创建主窗口。
手动检查更新
在主窗口中绑定“检查更新”按钮:
using GZUpdate.Client.WPF;
void CheckUpdate_Click(object sender, RoutedEventArgs e)
{
WpfUpdateClient.CheckAndUpdate(this, WpfUpdateMode.Manual);
}
手动模式下,发现新版本会先询问用户是否升级;升级完成后默认保留进度窗口上的“重启”按钮,由用户手动重启。
可选配置
WpfUpdateClient.Configure(new WpfUpdateOptions
{
Server = "https://update.infnitee.com/",
ProductId = "YourProductId",
VersionType = EnumVersionType.release,
UpgradeExecutorDllPath = "__upgrade_executor_dll",
RestartAfterStartupUpdate = true,
RestartAfterManualUpdate = false,
PromptBeforeManualUpdate = true,
ShowNoUpdateMessage = true
});
自定义升级进度窗口
实现 IWpfUpdateProgressDialogFactory 和 IWpfUpdateProgressDialog,并在 Configure 时注入 ProgressDialogFactory。接口提供消息、下载进度、升级包进度、完成、失败以及关闭控制方法;所有 UI 更新必须自行切换到对应 WPF Dispatcher。
返回结果
CheckAndUpdate 返回 WpfUpdateResult:
Status:本次检查或升级的最终状态。IsUpdated:是否已完成升级。ShouldExitApplication:是否应停止当前启动流程。LatestVersion:检测到的最新版本。CurrentVersion:升级后写入的当前版本。Error:失败异常。
支持框架
net472net5.0-windowsnet7.0-windowsnet8.0-windows
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0-windows7.0 is compatible. net6.0-windows was computed. net7.0-windows was computed. net7.0-windows7.0 is compatible. net8.0-windows was computed. net8.0-windows7.0 is compatible. net9.0-windows was computed. net10.0-windows was computed. |
| .NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.7.2
- GZUpdate.Client (>= 26.104.1004)
-
net5.0-windows7.0
- GZUpdate.Client (>= 26.104.1004)
-
net7.0-windows7.0
- GZUpdate.Client (>= 26.104.1004)
-
net8.0-windows7.0
- GZUpdate.Client (>= 26.104.1004)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 26.101.1005 | 113 | 9/3/2026 |