-
Notifications
You must be signed in to change notification settings - Fork 1
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
A couple questions, and thank you for the demo! #1
Comments
As expected you are right. The null checks where necessary before I wrote the canExecute. They are now removed. I wrote the AsyncYesNoMessage from your June 18 example . Just now I read that you have introduced the AsyncRequestMessage on July 1st. I have updated my code. Thanks for your remarks. I started MVVM (Silverlight period) using the MVVMLight framework. Used my own implementations (mainly ObservableObject, RelayCommand) in UWP apps. I will switch to your solution for future projects. It is nice that this also works form WPF. My solution now also contains a ClassLibrary (Models, ViewModels, Services, Messages), a WPF project (MainWindow) and a UnitTest. To make it complete. |
Happy to help! I'm really glad to hear you plan to switch to this new library for future projects, hope it'll work great for you! |
I'm not sure how I can use ObservableRecipient. This is a new pattern for me. Will play with to figure it out next. |
It's mostly done to facilitate the usage of the The idea is that if you register messages only from Also note that you can register messages with the pattern you prefer, you don't have to use Let me know if the docs on |
Hey Fons,
Thank you for taking the time to try out the new lib and for building a demo, this is cool! 😄
I'm glad to hear the new lib is working fine for you so far!
I have a couple of quick feedbacks/questions:
Async request messages
I was looking at this line:
ToolkitMvvmDemo/MvvmDemo/ViewModels/MainViewModel.cs
Line 41 in 12c7a3c
Where you have that verbose
.Result
access at the end. I checked the request message, which is:ToolkitMvvmDemo/MvvmDemo/Messages/AsyncYesNoMessage.cs
Line 10 in 12c7a3c
And you've just inherited from
RequestMessage<T>
with aTask<T>
type. For these situations, I've created theAsyncRequestMessage<T>
, which is basically the same but supportingTask<T>
results directly, so that the code is less verbose and you can directly useawait
in a message of that type, as it implementsGetAwaiter
and just relays that call to the wrappedTask<T>
instance. If you give it a try, let me know if that works! You should literally just be able to have your message inherit fromAsyncRequestMessage<bool>
, and then remove that.Result
when awaiting the request.Redundant
null
checks?I noticed these checks here:
ToolkitMvvmDemo/MvvmDemo/ViewModels/MainViewModel.cs
Line 40 in 12c7a3c
Since these methods are private and only invoked from the commands, which have a
canExecute
method that also checks whether the input is notnull
, whouldn't it be possible to remove these checks here to make the code less verbose? Did you try this out already? I'm just curious to know whether you did this just out of habit or whether you had any issues when trying to remove those checks. Let me know!Thanks again for your time testing this out, I really appreciate it! 😊
The text was updated successfully, but these errors were encountered: