-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support WindowEx Persistence in unpackaged apps #61
Comments
According to microsoft/WindowsAppSDK#1721 (comment), we are supposed to just use file storage in the If unpackaged apps needs to be supported, we'd need some sort of extension point where the developer can take over and save the settings somewhere, but then most of what WinUIEx does for you wrt this would go away.
|
We generally strive for parity between MSIX and non-MSIX apps. At least in Template Studio's case, we do provide an unpackaged implementation for local settings that writes to LocalAppData using configurable paths. Not providing settings storage at all because MSIX has a better way to do it is not really an option there, and LocalAppData has been the standard way to do it. Yes I understand the drawbacks compared to MSIX ApplicationData but developers have been dealing with this for years. I wouldn't expect the library to clean up on uninstall, I would expect the app to continue to manage its own LocalAppData. If WinUIEx contained a similar supporting implementation, I guess one option would be to expose a WinUIEx/src/WinUIEx/WindowManager.cs Lines 241 to 328 in 9e4beb4
Are there other ways we could allow apps to reuse your code here for saving and restoring window state? In Template Studio's case, the app will have its own local settings storage implementation already, what could a solution look like that didn't require you to implement your own unpackaged implementation for settings storage? |
I could provide some sort of property bag interface on the window manager - something along the lines of: public class WindowManager
{
public static IDictionary<string,object>? PersistanceStorage { get; set; } Would this work? On a packaged app it would just default to So in your code you could just initialize it if it is null. |
Fixed. See WinUIEx/src/WinUIExSample/App.xaml.cs Line 35 in 5e179c2
|
Setting
WindowEx.PersistenceId
in an MSIX app preserves window size and position. This isn't currently supported for unpackaged apps, though.Would be great if we could support this in unpackaged apps as well that don't use MSIX. I understand that the implementation of Persistence today relies on the
ApplicationData
API which is only available to packaged apps. How could we support unpackaged apps as well?The text was updated successfully, but these errors were encountered: