private void updateLocale(object sender, EventArgs e) { //if (dataGridView1.CurrentRow == null) //{ // Tool.show("请选择一行"); // return; //} Locale locale = (Locale)dataGridView1.CurrentRow.Tag; if (locale == null) { Tool.show("请选择一行"); return; } LocaleAdd form = new LocaleAdd(); form.setLocale(locale); //标记 form.Tag = locale; form.FormClosed += childClose; this.Tag = tag_update; form.Show(); }
private void Add_Click(object sender, EventArgs e) { LocaleAdd from = new LocaleAdd(); from.FormClosed += childClose; from.Show(); this.Tag = tag_insert; }
private void childClose(object sender, EventArgs e) { LocaleAdd form = (LocaleAdd)sender; Locale lo = form.locale; string tag = (string)this.Tag; if (tag.Equals(tag_insert)) { dao.addLocale(lo); } else { dao.updateLocale(lo); } initData(); }