如何在 Windows 窗体中维护会话? [英] How do I maintain session in windows forms?

查看:39
本文介绍了如何在 Windows 窗体中维护会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Windows 应用程序上维护会话.

I want to maintain session on a windows application.

如何像我们在 ASP.NET 中使用的那样维护用户会话来跟踪用户信息?

How do I maintain the session of a user like we use in ASP.NET to track the user information?

推荐答案

如果您的意思是,如何序列化用户使用您的应用程序完成的程序设置,并且您想在程序重新启动后恢复它们,这是一种简单的方法是内置的 设置管理.这适用于 WinForms 和 WPF:

If you mean, how one can serialize program settings the user has done using your app, and you want to restore them after the program has restarted, an easy way is the built in settings-management. This works with WinForms and WPF:

在 VS 的属性下,您可以定义应用程序中使用的所有设置(包含数据类型),然后您可以通过 Properties.Settings.Default-Property 设置和获取值.请注意,存在两种类型的设置:ApplicationUser.您需要保存用户的会话"状态的那个是 User.

In VS under properties, you can define all settings that in the app are used (inclusive data-type) and then you can set and get values over the Properties.Settings.Default-Property. Please note that there exists two type of settings: Application and User. The one you will need to save "session"-state of your user, is User.

请参阅此处了解有关保存的更多信息.net Windows 应用程序中的设置.

See here for more information about saving settings in .net windows applications.

这篇关于如何在 Windows 窗体中维护会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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