具有登录身份验证的WPF和MVVM [英] WPF and MVVM with login authentication

查看:358
本文介绍了具有登录身份验证的WPF和MVVM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我是WPF的新手,并想找出使用​​存储在Sql服务器数据库中的用户名/密码对用户进行身份验证的最佳方法.我正在使用MVVM框架,根据我的阅读,建议在代码上的按钮上不要包含任何Click事件 在窗户后面.因此,不确定如何验证用户.

谢谢

Hi,
I'm pretty new to WPF and wanted to find out the best way to authenticate an user with the username/password stored in a Sql server database . I'm using MVVM framework and from what I read it was suggested not to have any Click events for a button on the code behind in a window. So not sure how do I go about validating an user.

Thank you

推荐答案

当我想在MVVM中进行用户交互时,我的第一个方向是将事件添加到ViewModel并让View注册它.您将必须提供自己的EventArgs派生类(它需要一个经过身份验证"的bool值,默认为false,也许 处理过的"布尔值).
When I want to have user Interaction in MVVM my first direction would be to add a event to the ViewModel and let the View register it. You would have to provide your own EventArgs derivate (it needs a "authenticated" bool value, default false and maybe a "handeled" boolean).


这篇关于具有登录身份验证的WPF和MVVM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆