Ejemplo n.º 1
0
        void frmConfig_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (saveSuccess != null)
            {
                LogProgram.WriteBeginReloadConfig();
                this.Hide();

                //if (this.saveSuccess == false)
                //{

                //    // app
                //    AppParams.serverConfig.Read();
                //    AppParams.cd1800Config.Read();
                //    AppParams.eblx200Config.Read();
                //    ServerConnect.I.ReadConfidFromAppParams();
                //    CD1800Connect.CurrentConnect.ReadConfidFromAppParams();
                //    EBLX200Connect.I.ReadConfidFromAppParams();

                //}
                string error      = "";
                string warningCLS = "";
                string successCLS = "";
                bool   isServer   = ServerConnect.I.Connect();
                bool   isCD1800   = false; // CD1800Connect.CurrentConnect.Connect();
                bool   isEBLX200  = false; // EBLX200Connect.I.Connect();
                bool   isLaura    = false; // LauraSmartConnect.CurrentConnect.Connect();
                bool   isStago    = false; // StagoStart4Connect.CurrentConnect.Connect();
                bool   isE2010    = false; // Elecsys2010Connect.CurrentConnect.Connect();
                if (isServer)
                {
                    LogProgram.WriteConnectServerSuccess();
                }
                else
                {
                    LogProgram.WriteConnectServerFail();
                    error = "Không thể kết nối cơ sở dữ liệu máy chủ";
                }
                if (isCD1800)
                {
                    LogProgram.WriteConnectCD1800Success();
                    successCLS += "CD 1800,";
                }
                else
                {
                    LogProgram.WriteConnectCD1800Fail();
                    warningCLS += "CD 1800,";
                }
                if (isEBLX200)
                {
                    LogProgram.WriteConnectEBLX200Success();
                    successCLS += "EBLX 200,";
                }
                else
                {
                    LogProgram.WriteConnectEBLX200Fail();
                    warningCLS += "EBLX 200,";
                }
                if (isEBLX200)
                {
                    LogProgram.WriteConnectLauraSmartSuccess();
                    successCLS += "Laura Smart,";
                }
                else
                {
                    LogProgram.WriteConnectLauraSmartFail();
                    warningCLS += "Laura Smart,,";
                }
                if (isStago)
                {
                    LogProgram.WriteConnectStart4Success();
                    successCLS += "Stago Start 4,";
                }
                else
                {
                    LogProgram.WriteConnectStart4Fail();
                    warningCLS += "Stago Start 4,";
                }

                if (isE2010)
                {
                    LogProgram.WriteConnectStart4Success();
                    successCLS += "Elecsys 2010,";
                }
                else
                {
                    LogProgram.WriteConnectStart4Fail();
                    warningCLS += "Elecsys 2010,";
                }

                if (error != "")
                {
                    frmMain.formMain.m_notifyicon.Icon = global::ConnectLab.Properties.Resources.disconnect;

                    frmMain.formMain.m_notifyicon.ShowBalloonTip(4, "MKV Soft - Lỗi", error, ToolTipIcon.Error);
                }
                else if (warningCLS != "")
                {
                    frmMain.formMain.m_notifyicon.Icon = global::ConnectLab.Properties.Resources.inconnect;
                    frmMain.formMain.m_notifyicon.ShowBalloonTip(4, "MKV Soft  - Cảnh báo", "Không thể kết nối máy xét nghiệm: " + warningCLS.TrimEnd(','), ToolTipIcon.Warning);
                }
                else
                {
                    frmMain.formMain.m_notifyicon.Icon = global::ConnectLab.Properties.Resources.connect;
                    frmMain.formMain.m_notifyicon.ShowBalloonTip(4, "MKV Soft - Thông báo", "Kết nối thành công cơ sở dữ liệu máy chủ.\nKết nối thành công máy:  " + successCLS.TrimEnd(','), ToolTipIcon.Info);
                }
                LogProgram.WriteEndReloadConfig();
            }
            LogProgram.WriteCloseFormConfig();
        }