我如何保持一个WinForms应用程序用户的登录信息? [英] How do I maintain user login details in a Winforms application?

查看:98
本文介绍了我如何保持一个WinForms应用程序用户的登录信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨可以是很新Windows窗体。在这里,我想在Windows窗体中维护状态(如在Web应用程序会话)。

Hi can I'm very new to windows forms. Here I want to maintain state (like session in web applications) in windows forms.

其实我想存储在会话的用户登录信息。但我认为是的WinForms没有会话的概念。那么,什么是处理这种情况的另一种方法。

Actually i want to store user login details in session. But i think there is no concept of session in winforms. So what is the alternative method to handle this type of situation.

问候,
纳古

推荐答案

有是在Windows窗体没有会话变量的概念。你可以做的是:

There is no concept of Session variables in windows forms. What you can do is:


  1. 创建一个保存用户名和密码,在应用程序(喜欢的东西Common.cs)所需的任何其他变量和枚举一个内部类。这些可以通过跨应用程序的公共属性来访问。

  1. Create a internal class that holds the User name and password and any other variables and enumerations needed across the application (Something like Common.cs). These can be accessed through public properties across the application.

对所有的形式参数的构造函数,并发送用户名,只要你的显示形式的密码。

Have a parameterized constructor for all the forms and send the user name and the password whenever you are showing the form.

这篇关于我如何保持一个WinForms应用程序用户的登录信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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