在我的C#WPF應用程序中,我正在檢查是否需要安裝新版本。如果是這樣,我想打破當前的過程,並開始安裝。安裝程序是使用NSIS包開發的。 問題是,有時只有來自NSIS安裝程序的用戶帳戶控制對話框出現並安裝進程中斷。從c#wpf應用程序運行安裝過程
如何確保安裝過程中,每次執行?
這是我在應用程序啓動時的代碼。
protected override void OnStartup(StartupEventArgs e)
{
try
{
//Disable shutdown when the dialog closes
Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
if (IfUpdateRequired())
{
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(sessionCtx.AutoUpdateVersionInfo.SetupPath);
//This should not block current program
startInfo.UseShellExecute = true;
startInfo.Verb = "runas";
System.Diagnostics.Process.Start(startInfo);
this.Shutdown();
}
else
{
base.OnStartup(e);
}
}
catch (Exception ex)
{
}
}
你可能會添加一個「啓動屏幕通知系統修改」的屏幕截圖,因爲我不太明白你在說什麼。 – Anders
我的意思是「用戶帳戶控制對話框」。 – iljon
「安裝過程中斷」時會發生什麼?有沒有任何錯誤信息或類似的東西? – Anders