/* * CompletePage.xaml.cs - Better-Seewo 安装向导完成页面逻辑 * 显示安装摘要信息,提供启动管理器和关闭安装程序的入口 * 作者:雾启工作室 */ using System; using System.Diagnostics; using System.IO; using System.Windows; using System.Windows.Controls; namespace Better_Seewo.Installer.Pages { /// /// CompletePage 的交互逻辑 - 安装向导完成页面 /// public partial class CompletePage : Page { /// /// 构造函数,初始化页面组件并填充安装摘要 /// public CompletePage() { InitializeComponent(); // 填充安装摘要信息 LoadInstallSummary(); } /// /// 加载安装摘要信息到界面 /// private void LoadInstallSummary() { // 版本号 TxtVersion.Text = $"v{App.AppVersion}"; // 安装路径 TxtInstallPath.Text = App.InstallPath; // 安装时间 if (App.InstallStartTime != DateTime.MinValue) { var duration = DateTime.Now - App.InstallStartTime; TxtInstallTime.Text = $"{App.InstallStartTime:yyyy-MM-dd HH:mm:ss} (耗时 {duration.TotalSeconds:F1} 秒)"; } else { TxtInstallTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } } /// /// 启动管理器按钮点击 - 尝试启动 Better-Seewo Manager /// private void BtnLaunchManager_Click(object sender, RoutedEventArgs e) { try { // 尝试查找并启动管理器可执行文件 string managerPath = Path.Combine( Path.GetDirectoryName(App.InstallPath), "Better-Seewo.Manager.exe" ); if (File.Exists(managerPath)) { // 启动管理器 Process.Start(new ProcessStartInfo { FileName = managerPath, UseShellExecute = true }); // 关闭安装程序 Application.Current.Shutdown(); } else { // 管理器文件不存在,提示用户 MessageBox.Show( "未找到管理器程序。您可以稍后手动启动 Better-Seewo 管理器。", "Better-Seewo 安装程序", MessageBoxButton.OK, MessageBoxImage.Information ); } } catch (Exception ex) { MessageBox.Show( $"启动管理器失败:{ex.Message}", "Better-Seewo 安装程序", MessageBoxButton.OK, MessageBoxImage.Warning ); } } /// /// 关闭按钮点击 - 关闭安装程序 /// private void BtnClose_Click(object sender, RoutedEventArgs e) { Application.Current.Shutdown(); } } }