public FrmMain() { frmCauHinhCSDL cauhinhCSDL = new frmCauHinhCSDL(); if (cauhinhCSDL.Kiem_Tra_Ket_Noi(SqlHelper.ConnectionString)) { InitializeComponent(); rbcMain.SelectedPage = rbpKhoHang; lblDatabase.Caption = "CSDL: " + SqlHelper.TenCSDL; lblServer.Caption = "Máy chủ: " + SqlHelper.MayChu; } else { cauhinhCSDL.ThanhCong += cauhinhCSDL_ThanhCong; cauhinhCSDL.FormClosed += (ss, ee) => { if (!IsLoginSuccess) { Application.Exit(); } }; cauhinhCSDL.ShowDialog(this); } //InitializeComponent(); }
private void bbiCauHinhCSDL_ItemClick(object sender, ItemClickEventArgs e) { if (_frmCauHinhCSDL == null) { _frmCauHinhCSDL = new frmCauHinhCSDL(); _frmCauHinhCSDL.IsAppExit = false; _frmCauHinhCSDL.FormClosing += (ss, ex) => { _frmCauHinhCSDL = null; }; _frmCauHinhCSDL.ShowDialog(); } }