You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to make a shopping app using FreshMVVM.
I created two pages HomePage and BasketPage (the pagemodels are HomePageModel and BasketPageModel respectively).
HomePage will defined a listview of items and each item will have a button Order. When user clicks Order on a certain item then it will bind to command AddToBasketCommand in the pagemodel.
The command will Send a message (using MessingCenter) with parameter is the item orderred. The code to initialize the command in HomePageModel constructor like this
On BasketPageModel, I subscribed the message in Init function
publicclassCartPageModel:FreshBasePageModel{
...publicoverridevoidInit(objectinitData){MessagingCenter.Unsubscribe<HomePageModel,Menu_Tbl>(this,MessageKeys.AddFood);MessagingCenter.Subscribe<HomePageModel,Menu_Tbl>(this,MessageKeys.AddFood,async(sender,arg)=>{Console.WriteLine("Callback for AddToBasketCommand was fired");//do some stuffs}}
When I run the app and click on Order button, the command was binded sucessfully but the callback on MessagingCenter.Subscribe on BasketPageModel is not triggerred.
Can anyone help me on this bug. Thanks
The text was updated successfully, but these errors were encountered:
@lucastien as a work around can you get the subscribed callback to be invoked in the page of the page view model and then using the binding context do what you need on the view model?
I am trying to make a shopping app using FreshMVVM.
I created two pages HomePage and BasketPage (the pagemodels are HomePageModel and BasketPageModel respectively).
HomePage will defined a listview of items and each item will have a button Order. When user clicks Order on a certain item then it will bind to command AddToBasketCommand in the pagemodel.
The command will Send a message (using MessingCenter) with parameter is the item orderred. The code to initialize the command in HomePageModel constructor like this
On BasketPageModel, I subscribed the message in Init function
When I run the app and click on Order button, the command was binded sucessfully but the callback on MessagingCenter.Subscribe on BasketPageModel is not triggerred.
Can anyone help me on this bug. Thanks
The text was updated successfully, but these errors were encountered: