daniel-lerch / vocup

Vocabulary trainer.
https://www.microsoft.com/store/apps/9N6W2H3QJQMM
GNU Affero General Public License v3.0
9 stars 3 forks source link

Portable configuration #19

Closed daniel-lerch closed 2 years ago

daniel-lerch commented 3 years ago

Vocup 1.x stores all configuration in .NET user settings which have a fixed path and are therefore not suitable for portable editions. For Vocup 2.x which will be based on Avalonia and .NET 5.0 a new solution is required.

Requirements:

Known candidates:

Schafwolle commented 3 years ago

Hy I have looked through the readme.md of the anakic/Jot. If you like, I can try to integrate the anakic/Jot as a submodule to vocup (I would like to learn more about submodules 😉 ) and to implemented a prototype (save the position and size of the Main Form) for the Avalonia framework (As far as I have seen it is only tested for WPF and Forms).

Edit: I though about it and it is probably better to use the npm package.

daniel-lerch commented 3 years ago

We're not going to use another settings framework for Vocup 1.x. because that would be too much work for the existing application. Vocup 2.x is based on Avalonia which is very similar to WPF.

In terms of packaging you're right: Git submodules are usually not used for that. .NET has a package manager called NuGet which is comparable to NPM for JavaScript.

I'll soon write another comment about which steps you could do next for testing Jot.

daniel-lerch commented 3 years ago

I just read the readme of Jot again and looked for more alternatives, but Jot can persist states with the least boilerplate code. However, I'm not sure whether it can persist nested objects which wouldn't be necessary for persisting window sizes, locations, etc. but for some settings and a list of recent files for example. Furthermore, these settings would have to accessible to multiple objects which might be difficult with Jot.

@Schafwolle you could start with tracking the sizes and locations of Vocup.Avalonia.Views.MainWindow with Jot. Before doing that, make sure that your fork's avalonia branch is up to date with the main avalonia branch.

Schafwolle commented 3 years ago

Hy Regarding nested objects. I believe in worst case it would be possible to use something like a facades class (with ITrackingAware) which is just a plain class holding data fields (similar to settings in windows forms).

I am more concerts towards Linux support but I guess a custom IStore could solve the problem of missing %appdata%

@daniel-lerch I will try to look into the prototype implementation this weekend.

Schafwolle commented 3 years ago

I tried to implement the prototype for the MainWindow View. If you like, you can check my feature branch fb-jot-proto.

I have noticed the following problems so far:

@daniel-lerch: Did I something wrong when I included the jot package?

I will further look into the WindowState problem tomorrow. The WindowState problem is from my point of view independent of the framework used for data tracking.

Schafwolle commented 3 years ago

I have looked further through the Avalonia API documentation. I guess for now we need to live with the problem that there is nothing like RestoreBounds.

I noticed you opened an Issue: XML documentation file is missing in distribution #47

daniel-lerch commented 3 years ago

Thank you for all your research work. I didn't have the time to respond to your comments on this issue until now. Tomorrow the winter break of university ends for me and I won't be able to invest as much in Vocup as this week.

You have done everything perfectly fine with Jot. The problem would be easy to fix for them as you have already seen from my issue. For Avalonia I see the same problems like you do. Maybe you can open an issue there to add RestoreBounds. It is existent in Windows Forms and WPF.

Since I have worked with ASP.NET Core for the first time, I enjoyed using Microsoft.Extensions.DependencyInjection very much and prefer it over static classes with static fields for services. If you already have some experience with dependency injection you could try to replace your static JotService with dynamic services. The services would be composed by the respective entry points of Vocup.Desktop and Vocup.Windows so that every platform can have different services for configuration, updates, etc.

Schafwolle commented 3 years ago

Just out of curiosity. Why don't we use the ReactiveUI Data Persistence ?

daniel-lerch commented 3 years ago

Great idea! I wasn't aware of this option. It seems to be much more flexible than Jot e.g. you can write your own storage providers and I like very much that it persists information from view models and not from the view directly.

Which of the data persistence options do you prefer?

Schafwolle commented 3 years ago

I prefer the ReactiveUI for the following reasons:

I am going to write another prototype for the MainWindow with the ReactiveUI that we can choose..

anakic commented 3 years ago

Hi guys. I'm the author of Jot. Just got around to fixing some issues with Jot, e.g. missing XML docs in release build and NuGet packages. If you're still using Jot, let me know if I can help. Cheers!

anakic commented 3 years ago

However, I'm not sure whether it can persist nested objects which wouldn't be necessary for persisting window sizes, locations, etc. but for some settings and a list of recent files for example.

Tracking properties of nested objects is supported in Jot, see the MothersMaidenName property in this example in the readme.

daniel-lerch commented 2 years ago

In the end losttech/Settings outperformed other libraries by supporting data binding, asynchronous auto save and offering finely grained control of serialization and filenames.

Implementation completed with a3815d11ac76834f75fa4704fd3603086633c7f0.