File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/Files.App/ServicesImplementation Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 88using System . Diagnostics ;
99using System . IO ;
1010using System . Net . Http ;
11+ using System . Runtime . InteropServices ;
1112using System . Threading ;
1213using System . Threading . Tasks ;
1314using System . Xml . Serialization ;
@@ -19,6 +20,9 @@ namespace Files.App.ServicesImplementation
1920{
2021 public sealed class SideloadUpdateService : ObservableObject , IUpdateService , IDisposable
2122 {
23+ [ DllImport ( "kernel32.dll" , CharSet = CharSet . Unicode ) ]
24+ private static extern uint RegisterApplicationRestart ( string pwzCommandLine , int dwFlags ) ;
25+
2226 private const string SIDELOAD_STABLE = "https://cdn.files.community/files/stable/Files.Package.appinstaller" ;
2327 private const string SIDELOAD_PREVIEW = "https://cdn.files.community/files/preview/Files.Package.appinstaller" ;
2428
@@ -185,14 +189,18 @@ private async Task ApplyPackageUpdate()
185189
186190 try
187191 {
192+ var restartStatus = RegisterApplicationRestart ( null , 0 ) ;
193+
194+ Logger ? . Info ( $ "Register for restart: { restartStatus } ") ;
195+
188196 await Task . Run ( async ( ) =>
189197 {
190198 var bundlePath = new Uri ( ApplicationData . Current . LocalFolder . Path + "\\ " + TEMPORARY_UPDATE_PACKAGE_NAME ) ;
191199
192200 var deployment = pm . RequestAddPackageAsync (
193201 bundlePath ,
194202 null ,
195- DeploymentOptions . ForceTargetApplicationShutdown ,
203+ DeploymentOptions . ForceApplicationShutdown ,
196204 pm . GetDefaultPackageVolume ( ) ,
197205 null ,
198206 null ) ;
You can’t perform that action at this time.
0 commit comments