This is a mirror of official site: http://jasper-net.blogspot.com/

Loving MMVM and asynchronous operations

| Tuesday, May 3, 2011
I’m using in a project a modified version of MVVM in WPF originally made by my dear friend Mauro (check his project Radical, it is really cool). Actually I use a custom DelegateCommand to handle communication between View and the View Model. Here is a sample snippet on how I initialize a command in View Model.

SaveCurrent = DelegateCommand.Create()
.OnCanExecute(o => this.SelectedLinkResult != null)
.TriggerUsing(PropertyChangedObserver.Monitor(this)
.HandleChangesOf(vm => vm.SelectedLinkResult))
.OnExecute(ExecuteSaveCurrent);

This works but I need to solve a couple of problems.
The first one is that I never remember the syntax  . I find the name TriggerUsing() somewhat confusing (it is surely my fault  ) and moreover I hardly remember PropertyChangedObserver name of the class used to monitor the change of a property. This cause me every time I create a new DelegateCommand to search another VM to copy initialization. Since monitoring change of a property to reevaluate if a command can be executed is probably one of the most common logic, I wish for a better syntax to avoid being puzzled on what method to call.

Read more: Alkampfer's Place

Posted via email from Jasper-net

0 comments: