54 lines
1.8 KiB
C#
54 lines
1.8 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Configuration;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Drawing;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
|
|||
|
|
namespace 呼吸过滤器气雾直径测试仪
|
|||
|
|
{
|
|||
|
|
public partial class ChangPassword : Form
|
|||
|
|
{
|
|||
|
|
public ChangPassword()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void button1_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (textBox1.Text == "07283622")
|
|||
|
|
{
|
|||
|
|
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
|||
|
|
// 更新或添加一个键值对到 AppSettings 配置节
|
|||
|
|
config.AppSettings.Settings["MaxExpirationPeriodInDays"].Value = "40";
|
|||
|
|
// 保存更改到配置文件
|
|||
|
|
config.Save(ConfigurationSaveMode.Modified);
|
|||
|
|
|
|||
|
|
// 重新加载配置文件
|
|||
|
|
ConfigurationManager.RefreshSection("appSettings");
|
|||
|
|
|
|||
|
|
MessageBox.Show("配置值已成功保存!", "保存成功");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (textBox1.Text == "45983625")
|
|||
|
|
{
|
|||
|
|
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
|||
|
|
// 更新或添加一个键值对到 AppSettings 配置节
|
|||
|
|
config.AppSettings.Settings["MaxExpirationPeriodInDays"].Value = "36500";
|
|||
|
|
// 保存更改到配置文件
|
|||
|
|
config.Save(ConfigurationSaveMode.Modified);
|
|||
|
|
|
|||
|
|
// 重新加载配置文件
|
|||
|
|
ConfigurationManager.RefreshSection("appSettings");
|
|||
|
|
|
|||
|
|
MessageBox.Show("配置值已成功保存!", "保存成功");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|