开发者

MVVM & Navigation Framework

开发者 https://www.devze.com 2023-02-10 06:21 出处:网络
I have more of question than a problem at the moment and was looking for advice : I have an app that redirects the user to the \"Owners home page\" if they belong to a \"Owners\" role : Then , the a

I have more of question than a problem at the moment and was looking for advice :

I have an app that redirects the user to the "Owners home page" if they belong to a "Owners" role : Then , the app checks to see if they have an "account" (nothing to do wit开发者_开发百科h authentication) which is a collection of personal information similar to a profile.

I have implemted the MVVM pattern so far: Now my experience is running thin because I normally work with commands in the view model tied to click events in the view...

How should I go about keeping view code behind clean and accomodating the conditional redirects that the app needs to implement

Thanks


you would still use a vm for the logic of your button command. if the criteria is met you send a message to your nagigation handler that its to move to the proper page. MVVM-Light or parts of prism make this easy. You only need a minor piece of codebehind for the listener where you have your navigation frame and thats it...

0

精彩评论

暂无评论...
验证码 换一张
取 消