using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Welling_Motor_Debug_Tool { public partial class Licences : Form { public Licences() { InitializeComponent(); } private void Licences_Load(object sender, EventArgs e) { textBox_CPU_ID.Text = PC_Information.GetCPUSerialNumber(); textBox_LicencePath.Text = ""; } private void button_LicenceSelect_Click(object sender, EventArgs e) { // 创建并配置OpenFileDialog OpenFileDialog openFileDialog = new OpenFileDialog { InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop), // 初始目录 Filter = "许可文件(*.lic)|*.lic", // 文件过滤器 FilterIndex = 1, // 默认过滤器索引 RestoreDirectory = true // 关闭对话框后恢复当前目录 }; // 显示对话框并检查用户是否选择了文件 if (openFileDialog.ShowDialog() == DialogResult.OK) { // 获取选中文件的路径 string filePath = openFileDialog.FileName; // 在文本框中显示文件路径 textBox_LicencePath.Text = filePath; } } private void button_LicenceEnter_Click(object sender, EventArgs e) { this.Close(); } } }