Skip to content
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

Sample app updates #44

Merged
merged 6 commits into from
Jul 26, 2021
Merged

Sample app updates #44

merged 6 commits into from
Jul 26, 2021

Conversation

Sergio0694
Copy link
Member

✅ Updated all NuGet packages
✅ Switched to System.Text.Json serialization
✅ Enabled nullability annotations in .Core project
✅ Enabled app trimming for .NET Native in UWP sample app

@Sergio0694 Sergio0694 added the enhancement New feature or request label Mar 26, 2021
@virzak
Copy link

virzak commented Apr 3, 2021

Looking to adapt this library, in a code base which is already annotated with Nullable.
Migrating away from MvvmLight is resulting in:

-        private bool WindowDrop_CanExecute(DragEventArgs e)
+        private bool WindowDrop_CanExecute(DragEventArgs? e)
        {
+            _ = e ?? throw new ArgumentNullException(nameof(e));

everywhere where an argument is used.

Are there any future plans to introduce the API below?

    public sealed class AsyncRelayCommand<T> : ObservableObject, IAsyncRelayCommand<T>, IAsyncRelayCommand, IRelayCommand, ICommand, INotifyPropertyChanged, IRelayCommand<T>
    {
        public AsyncRelayCommand(Func<T?, Task> execute);
        public AsyncRelayCommand(Func<T?, CancellationToken, Task> cancelableExecute);
        public AsyncRelayCommand(Func<T?, Task> execute, Predicate<T?> canExecute);
        public AsyncRelayCommand(Func<T?, CancellationToken, Task> cancelableExecute, Predicate<T?> canExecute);
+        public AsyncRelayCommand(Func<T, Task> execute);
+        public AsyncRelayCommand(Func<T, CancellationToken, Task> cancelableExecute);
+        public AsyncRelayCommand(Func<T, Task> execute, Predicate<T> canExecute);
+        public AsyncRelayCommand(Func<T, CancellationToken, Task> cancelableExecute, Predicate<T> canExecute);

@Sergio0694
Copy link
Member Author

Hi @virzak, adding those overloads would just not be possible, because they'd be conflicting.
As in, T and T? in this context is quite literally the same type, so those overloads are not actually overloads - they're the same.
The reason why the input arguments for these commands is nullable is for consistency with the actual ICommand interface, which takes a nullable object? parameter for both the Execute and CanExecute methods. So we're just following suit with that 🙂

{x:Bind OneWay} still creates the code to set the bound properties in XamlTypeInfo.g.cs even though that's never actually used. If that property is init-only, that fails to build. Ideally these bindings should just omit those methods entirely.
Docs need updating still, but this will make things simpler with MAUI integration going forwards as the package reference will already be the right one
@Sergio0694
Copy link
Member Author

@michael-hawker I've double checked everything's in place and did a force push to keep the history clean.
I've also switched to CommunityToolkit.Mvvm in 6b3a4e9 to make things simpler for #49 👍

@Sergio0694 Sergio0694 mentioned this pull request Jul 23, 2021
@michael-hawker
Copy link
Member

Thanks @Sergio0694 I'll try and check the XF sample with this PR today or Monday.

@michael-hawker
Copy link
Member

Had to make some small tweaks, but the XF sample is working here too.

@michael-hawker michael-hawker merged commit 17f1251 into master Jul 26, 2021
@delete-merged-branch delete-merged-branch bot deleted the update/uwp-sample branch July 26, 2021 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants