Skip to content

Commit ebe5b16

Browse files
committedOct 19, 2024
Update MicrosoftStoreUpdateService.cs
1 parent 8c1f8ae commit ebe5b16

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed
 

‎src/Platforms/SecureFolderFS.Uno/Platforms/Windows/ServiceImplementation/MicrosoftStoreUpdateService.cs

+16-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ public async Task<IResult> UpdateAsync(IProgress<double>? progress, Cancellation
9494

9595
private async Task<bool> SetStoreContextAsync()
9696
{
97-
_storeContext ??= await Task.Run(StoreContext.GetDefault);
97+
if (_storeContext is null)
98+
{
99+
_storeContext = await Task.Run(StoreContext.GetDefault);
100+
if (_storeContext is not null)
101+
WinRT_InitializeObject(_storeContext);
102+
}
103+
98104
return _storeContext is not null;
99105
}
100106

@@ -114,5 +120,14 @@ private static AppUpdateResultType GetAppUpdateResultType(StorePackageUpdateStat
114120
_ => AppUpdateResultType.None
115121
};
116122
}
123+
124+
private static void WinRT_InitializeObject(object obj)
125+
{
126+
_ = obj;
127+
#if WINDOWS
128+
var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(App.Instance?.MainWindow);
129+
WinRT.Interop.InitializeWithWindow.Initialize(obj, hwnd);
130+
#endif
131+
}
117132
}
118133
}

0 commit comments

Comments
 (0)
Please sign in to comment.