如何使工具条按钮的密码受保护? C# [英] How do i make a toolstrip button password protected? c#

查看:96
本文介绍了如何使工具条按钮的密码受保护? C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在c#中的Visual Studio 2010中使用Windows窗体应用程序为儿童创建Web浏览器.

我正在尝试创建一个家长区域,父母可以控制孩子们的一些功能,但我无法让这些功能正常工作.

1.我需要在工具条中设置一个受密码保护的按钮,并链接到一些数据库以进行验证,如果丢失了密码,则可以采用某种方法来检索密码.
我已经可以访问mysql数据库,但是需要知道如何执行此操作.

2.需要能够控制按钮的视图,以便在父区域中可以禁用打印按钮.

3.浏览器使用字符串仅允许访问该字符串中列出的网站,所有其他网站均不会加载.我将如何让用户能够访问此字符串,以便他们可以将自己的网站添加到列表/

4.我想添加一个计时器控件,以便家长可以为他们的孩子设置玩耍的时间限制.例如,一个小时后,浏览器将显示一个屏幕,显示时间已到,直到父母输入密码关闭或允许进一步访问,用户才能访问,因为孩子可能正在玩游戏,需要保存.等..

5.我在浏览器的按钮上有音频,如果用户愿意,可以使用另一个按钮关闭这些声音.

6.我将类别按钮放置在左侧的工具条中,它很长,需要用户向下滚动才能查看所有内容,我已经能够将它们添加到面板中以允许滚动功能,但是它滚动条看起来不好...有没有办法使用按钮呢?以便他们单击一个大按钮,菜单便会上下滚动?


我正在为我的孩子们的一个项目创建它,我的编程虽然很基础,但是我认为它会很有趣,而且我的孩子会喜欢.

我已经制作了网站,浏览器框架和自定义按钮仅需要这些功能的帮助.

预先感谢您,我和我的孩子真的很感谢所有帮助!

Hi
I''m creating a web browser for children using windows form application in visual studio 2010 in c#.

I am trying to create a parental area where parents can control some featurs for the kids, i am having trouble getting these features to work.

1. I need to make a button in the toolstrip password protected, and link to some database to validate and have some way to retrieve password if lost.
I already have access to a mysql database, but would need to know how to do this.

2. Need to be able to control the view of a button, so that in the parent area they can disable the print button.

3. The browser uses a string to only allow access to websites listed in that string, all others won''t load. How would i let the user be able to access this string so they can add their own sites to list/

4. I want to add a timer control so that the parent can set a time limit for their children to play. ex after an hour the browser displays a screen saying time up and the user can''t have access until parent enters password to close or allow further access, as the kid might be in the middle of a game and need to save it.. etc..

5. I have audio on the buttons in the browser, is there a way to use another button to turn off these sounds if the users wants to.

6. I have placed category buttons in a toolstrip down the left, it is quite long and requires the the users to scroll down to view them all, I have been able to add them in a panel to allow the ability of scrolling, but it doesn''t look good with the scroll bars... is there a way to use buttons instead? so that they click on a big button and the menu scrolls up and down?


I am creating this for a project for my children, my programming is rather basic but I thought it would be fun and something my kids would enjoy.

I have already made the website and the the browser frame and custom buttons just need help with these features.

Thank you in advance all help is really appreciated by myself and my kids!!!

推荐答案

您尝试做的事情很琐碎,但我相信您缺乏适当的理解C#和访问/使用数据库.请考虑搁置您的项目,并阅读/练习更多您的编码技能.为什么现在要编写代码,并在将来变得更好之后再重做整个代码,因为您会发现它太冗长/blo肿了?
希望我没有冒犯您,但是所有的尝试是向您展示如何通过拥有更多可收获的知识来制作一款出色的浏览器. wrox网站上有一些非常不错的电子书和教程,您还可以搜索一本叫做"Head first c#"(来自wrox的书,但它是最好的书,非常适合c#中的绝对初学者)
一切顺利.
What your trying to make is very trivial but I believe you lack a proper understanding of c# and accessing / using databases. Please consider putting your project on hold and read/practise more on your coding skills. Why code now and redo your whole code in future (after you''ve become better) since you''ll have discovered how verbose/bloated it is?
I hope I haven''t offended you but all am trying is to show you how to make a good browser by having more knowledge which pays off. There some very good ebooks and tutorials from the wrox site plus you can search for one called ''Head first c#'' (aint from wrox but its the best one,well suited for absolute beginners in c#)
all the best.


button1_Click(object sender, EventArgs e)
{
  PassForm pf = new PassForm();
  if (pf.ShowDialog()==DialogResult.Cancel)
  return;
  if (pf.password == Properties.Settings.Default.pass)
  {
    // do events
  }
  else
  {
    // MessageBox.Show("Error Performing Requested Operation","KiddieBrowser 1.0",0,MessageBoxIcon.Error);
  }
}


第1点和第2点.
您在此处尝试做的是角色管理的典型案例. Microsoft从版本2开始就通过.NET有用地提供了角色管理功能,并且您可以在Windows Forms和ASP.NET应用程序中使用这些功能.您需要搜索以下内容:

MySQL成员资格提供程序
MySQL角色提供程序
Windows窗体成员资格和角色提供程序(以了解如何向您的应用程序添加角色和成员资格功能)

您还需要阅读这些提供程序的功能.

点3.
这是一个棘手的问题,因为您将不得不拦截导航请求.仅阻止来自地址栏的链接是不够的.如果他们可以访问的页面提供了指向不在列表中的网站的链接该怎么办?另外,您如何处理这些站点中的映射?您是否允许访问所有站点?特定的文件夹?特定页面?查看您的Web浏览器设置,看看浏览器提供商如何实现此功能-它应该使您对如何做自己想要的事情有更多的了解.

第4点.
相当直截了当-创建一个后台线程,并使其在该时间段内处于休眠状态.醒来时,它将显示该页面.请注意,如果用户退出会话,则必须记住关闭该线程.

第5点.
创建一个选项对话框可能会更好.听起来您那里有很多选择.
Points 1 and 2.
What you are trying to do here is a classic case of role management. Microsoft helpfully provide role management capabilities with .NET from version 2 on, and you can use these features in Windows Forms as well as ASP.NET applications. You need to search for the following things:

MySQL Membership Provider
MySQL Role Provider
Windows Forms Membership and Role Provider (to find out how to add role and membership capabilities to your app)

You also need to read up on what these providers do.

Point 3.
This is a trickier one because you are going to have to intercept navigation requests. It''s not enough to just block links from an address bar; what about if a page they can get to provides a link to a site that''s not on the list? Plus, how are you handling the mapping in these sites? Are you allowing access to all the site? Specific folders? Specific pages? Take a look in your web browser settings and see how the browser providers implement this feature - it should give you more of an idea on how to do what you want.

Point 4.
Fairly straight forward - create a background thread and have it sleep for that period of time. On waking up, it will display the page. Note, if the user exits the session, you must remember to close that thread.

Point 5.
You''re probably going to be better creating an options dialog. It sounds like you''ve got a fair few options going on there.


这篇关于如何使工具条按钮的密码受保护? C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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