public MainForm() { InitializeComponent(); m_syncContext = SynchronizationContext.Current; TheForm = this; DataBasePathName = Registor.GetRegistryKeyString("DataBasePathName", ""); if (DataBasePathName == "") { DataBasePathName = "D:\\DB.mdb"; Registor.SetRegistryKey("DataBasePathName", DataBasePathName); } Port = Registor.GetRegistryKeyInt("Port", -1); if (Port == -1) { Port = 1185; Registor.SetRegistryKey("Port", Port); } MaxLogCount = Registor.GetRegistryKeyInt("MaxLogCount", -1); if (MaxLogCount == -1) { MaxLogCount = 5000; Registor.SetRegistryKey("MaxLogCount", MaxLogCount); } }
private void button_OK_Click(object sender, EventArgs e) { if (File.Exists(textBox_DbFilePath.Text)) { Registor.SetRegistryKey("DataBasePathName", textBox_DbFilePath.Text); Registor.SetRegistryKey("Port", int.Parse(textBox_Port.Text)); Close(); } else { MessageBox.Show("指定的文件不存在"); } }