如果有更新,应用程序不应关闭

问题描述 投票:0回答:1

我正在使用 AutoUpdater.NET 来更新我的应用程序。这是一个很棒的图书馆。我的程序收集库存系统数据的数据,将其发送到数据库,然后关闭应用程序。

this.Close();

问题是,如果有可用更新,程序也会关闭。我希望应用程序保持打开状态,直到用户更新或取消。我知道我必须检查更新是否可用或更新表单是否打开,但我不知道如何。有人可以帮忙吗? (对不起,我是初学者)

AutoUpdater.Start(updatePath);
AutoUpdater.ShowSkipButton = false;
AutoUpdater.ShowRemindLaterButton = false;
AutoUpdater.Mandatory = true;
//AutoUpdater.UpdateMode = Mode.Forced;
AutoUpdater.RunUpdateAsAdmin = false;
var currentDirectory = new DirectoryInfo(Environment.CurrentDirectory);
if (currentDirectory.Parent != null)
{
    AutoUpdater.InstallationPath = currentDirectory.FullName;
}
c# auto-update
1个回答
0
投票

解决方案(就我而言)是将 Environment.CurrentDirectory 替换为 Application.StartupPath

© www.soinside.com 2019 - 2024. All rights reserved.