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 8
8
using System . Diagnostics ;
9
9
using System . IO ;
10
10
using System . Net . Http ;
11
+ using System . Runtime . InteropServices ;
11
12
using System . Threading ;
12
13
using System . Threading . Tasks ;
13
14
using System . Xml . Serialization ;
@@ -19,6 +20,9 @@ namespace Files.App.ServicesImplementation
19
20
{
20
21
public sealed class SideloadUpdateService : ObservableObject , IUpdateService , IDisposable
21
22
{
23
+ [ DllImport ( "kernel32.dll" , CharSet = CharSet . Unicode ) ]
24
+ private static extern uint RegisterApplicationRestart ( string pwzCommandLine , int dwFlags ) ;
25
+
22
26
private const string SIDELOAD_STABLE = "https://cdn.files.community/files/stable/Files.Package.appinstaller" ;
23
27
private const string SIDELOAD_PREVIEW = "https://cdn.files.community/files/preview/Files.Package.appinstaller" ;
24
28
@@ -185,14 +189,18 @@ private async Task ApplyPackageUpdate()
185
189
186
190
try
187
191
{
192
+ var restartStatus = RegisterApplicationRestart ( null , 0 ) ;
193
+
194
+ Logger ? . Info ( $ "Register for restart: { restartStatus } ") ;
195
+
188
196
await Task . Run ( async ( ) =>
189
197
{
190
198
var bundlePath = new Uri ( ApplicationData . Current . LocalFolder . Path + "\\ " + TEMPORARY_UPDATE_PACKAGE_NAME ) ;
191
199
192
200
var deployment = pm . RequestAddPackageAsync (
193
201
bundlePath ,
194
202
null ,
195
- DeploymentOptions . ForceTargetApplicationShutdown ,
203
+ DeploymentOptions . ForceApplicationShutdown ,
196
204
pm . GetDefaultPackageVolume ( ) ,
197
205
null ,
198
206
null ) ;
You can’t perform that action at this time.
0 commit comments