private void DB_SaveConfig(string name) { ExecuteSql(string.Format("insert into tb_config('name','config') values('{0}','{1}')", name, @textBox4.Text)); _saveCfgForm.Close(); _saveCfgForm = null; InitConfigItem(); MessageBox.Show("配置保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public MainForm() { InitializeComponent(); _sqlCon = "Data Source=" + System.IO.Directory.GetCurrentDirectory() + "\\MyDatabase.sqlite"; _imgIndexImgIDMap = new Dictionary <int, ImageKeys>(); _cur_ID = -1; _cur_Image_ID = -1; _imgMap = new Dictionary <ImageKeys, stImage>(); _cur_Image_Index = -1; _saveCfgForm = null; _configMap = new Dictionary <long, stConfig>(); _cur_config_id = -1; _cur_config_name = ""; }
private void 保存配置CToolStripMenuItem_Click(object sender, EventArgs e) { if (_cur_config_id != -1) { if (MessageBox.Show(string.Format("确定要覆盖原有配置({0})吗?", _cur_config_name), "覆盖配置", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK) { ExecuteSql(string.Format("update tb_config set config= '{0}' where id={1}", @textBox4.Text, _cur_config_id)); InitConfigItem(); MessageBox.Show("配置覆写成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { _saveCfgForm = new SaveCfgForm(); _saveCfgForm.SaveConfig = DB_SaveConfig; _saveCfgForm.Show(); } }