void btn_Click(object sender, EventArgs e) { FrmDictionary frm = Application.OpenForms.OfType <FrmDictionary>().FirstOrDefault(); if (frm != null) { frm.Close(); } SimpleButton simpleButton = sender as SimpleButton; if (simpleButton != null) { DanhMucCon nguphap = (simpleButton.Tag as DanhMucCon); FrmGrammar f = new FrmGrammar(nguphap.ID); f.Text = "Học ngữ pháp"; f.ShowDialog(); } }
private void btnDictionary_ItemClick(object sender, ItemClickEventArgs e) { try { FrmDictionary f = Application.OpenForms.OfType <FrmDictionary>().FirstOrDefault(); if (f != null) { XtraMessageBox.Show("Bạn đã mở tử điển! Xin hãy kiểm tra cửa sổ chương trình!", Resources.thong_bao, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { f = new FrmDictionary(); f.Show(); } } catch (Exception) { XtraMessageBox.Show(Resources.error_connectionstring, Resources.thong_bao, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void btn_Click(object sender, EventArgs e) { FrmDictionary frm = Application.OpenForms.OfType <FrmDictionary>().FirstOrDefault(); if (frm != null) { frm.Close(); } SimpleButton simpleButton = sender as SimpleButton; if (simpleButton != null) { BaiHoc baiHoc = (simpleButton.Tag as BaiHoc); FrmBaiHocChiTiet f = new FrmBaiHocChiTiet(baiHoc.ID); f.Text = f.Text + " số " + baiHoc.ID; //f. = this; f.Text = "Bài học"; f.ShowDialog(); } }