Avalonia Port (Phase 1): MVVM Refactor + macOS Support#4524
Avalonia Port (Phase 1): MVVM Refactor + macOS Support#4524Marc-André Moreau (mamoreau-devolutions) merged 5 commits intomainfrom
Conversation
66d1935
into
main
Maxim Buisson (MaxBuisson)
left a comment
There was a problem hiding this comment.
Left a few recommendations but this is just a phase 1 so it can be merged and the things can be done after
The main points are:
Many UI done in code with styles, which will make it hard to have different styles for macOS and other platforms
Many things in .axaml.cs that should be in the viewmodels
Few texts missing translations maybe
Also, there is a tooon of calls to the translate function and a ton of menus and labels created in code to have the translation. We should do a MarkupExtension to allow us to bind values in axaml views and have them be translated rather than creating all the labels in the code.
| } | ||
|
|
||
| // ── Bindable properties ─────────────────────────────────────────────────── | ||
| private string _title; |
There was a problem hiding this comment.
Why not use observable properties ?
|
|
||
| // ─── Collections ────────────────────────────────────────────────────────── | ||
| public ObservablePackageCollection FilteredPackages { get; } = new(); | ||
| public ObservableCollection<SourceTreeNode> SourceNodes { get; } = new(); |
There was a problem hiding this comment.
Should we use AvaloniaList like in RDM?
|
|
||
| public bool IsListViewMode => ViewMode == 0; | ||
| public bool IsGridViewMode => ViewMode == 1; | ||
| public bool IsIconsViewMode => ViewMode == 2; |
There was a problem hiding this comment.
Use an enum instead of int and checking if its 0,1,2 ?
| public event EventHandler<PageType>? CurrentPageChanged; | ||
|
|
||
| // ─── Operations panel ───────────────────────────────────────────────────── | ||
| public ObservableCollection<OperationViewModel> Operations |
There was a problem hiding this comment.
Avalonialist again maybe
| base.IsEnabled = value; | ||
| _warningBlock.Opacity = value ? 1 : 0.2; | ||
| } | ||
| get => base.IsEnabled; |
There was a problem hiding this comment.
Do we want this to be observable to be able to change it after creation and bind the UI to it ?
| { | ||
| Width = 1, | ||
| Height = 30, | ||
| Margin = new global::Avalonia.Thickness(4, 4), |
There was a problem hiding this comment.
In many places we create elements with styles in code directly, this is ok for now but eventually a .axaml would be better for styling between macOS, windows, linux, etc
There was a problem hiding this comment.
This realllyyy needs a view model 😓
| { | ||
| "light" => ThemeVariant.Light, | ||
| "dark" => ThemeVariant.Dark, | ||
| _ => ThemeVariant.Default, |
There was a problem hiding this comment.
is default valid ? In the styles we only seem to have dark and light 🤔
| <DependentUpon>Administrator.axaml</DependentUpon> | ||
| <SubType>Code</SubType> | ||
| </Compile> | ||
| <Compile Update="Views\Pages\SettingsPages\ManagersHomepage.axaml.cs"> |
There was a problem hiding this comment.
Can't we use something to auto include all .axaml like we do in RDM?
| { | ||
| Name = "Homebrew", | ||
| Description = CoreTools.Translate( | ||
| "The Missing Package Manager for macOS (or Linux).<br>Contains: <b>Formulae, Casks</b>" |
There was a problem hiding this comment.
br> and b> in desc works??? sus
Summary
This PR is phase 1 of the cross-platform port of UniGetUI from WinUI3 to Avalonia, targeting macOS for now.
Architecture overhaul
Features ported
New additions
Removed