Exemple #1
0
        private void FormMainRibbon_Load(object sender, EventArgs e)
        {
            if (DieuHanhTaxi.CheckConnection())
            {
                // Lưu ý:Làm hàm Load tối giản lại càng tốt
                RealTimeEnvironment.IniRealTime();

                PingApp         = new BackgroundWorker();
                PingApp.DoWork += PingApp_DoWork;
                using (var PingWcf = new BackgroundWorker())
                {
                    PingWcf.DoWork += (sender1, e1) => Service_Common.PingWcf();
                    PingWcf.RunWorkerAsync();
                }
                if (Config_Common.DienThoai_KhungDiaChi == KhungDiaChi.Duoi)
                {
                    PanelThongTinDiaChi.Dock = DockStyle.Bottom;
                }
                else
                {
                    PanelThongTinDiaChi.Dock = DockStyle.Top;
                }
                if (Config_Common.GridConfig != 1)
                {
                    btnAnHien.PerformClick();
                    btnAnHien.Visible = false;
                }

                #region ==== GridControl ====

                //  RealTimeEnvironment.LineVung = "124;179";
                // Lấy cấu hình.
                #region === Ini Data ===
                grvChoGiaiQuyet.FuncGetTimerServer = () => RealTimeEnvironment.TimeServer;
                grvChoGiaiQuyet.FuncGetAll         = CuocGoi.G5_DIENTHOAI_LayAllCuocGoi;
                grvChoGiaiQuyet.FuncGetNew         = CuocGoi.G5_DIENTHOAI_LayDSCuocGoiMoi_FT;
                grvChoGiaiQuyet.FuncGetUpdate      = CuocGoi.G5_DIENTHOAI_LayDSCuocGoiThayDoiByTongDai;
                grvChoGiaiQuyet.FuncGetDelete      = (Line, LsKeys) => CuocGoi.G5_DIENTHOAI_LayCacIDCuocGoiKetThucByTongDai(LsKeys, Line);
                grvChoGiaiQuyet.ActionPopUp       += grvChoGiaiQuyet_ActionPopUp;
                grvChoGiaiQuyet.EventActionStep   += grvChoGiaiQuyet_EventActionStep;

                grvCuocKhachLineKhac.FuncGetTimerServer = () => RealTimeEnvironment.TimeServer;
                grvCuocKhachLineKhac.FuncGetAll         = CuocGoi.DIENTHOAI_LayAllCuocGoi_Khac;
                grvCuocKhachLineKhac.FuncGetNew         = CuocGoi.DIENTHOAI_LayDSCuocGoiMoi_V3_Khac;
                grvCuocKhachLineKhac.FuncGetUpdate      = CuocGoi.DIENTHOAI_LayDSCuocGoiThayDoiByTongDai_V3_Khac;
                grvCuocKhachLineKhac.FuncGetDelete      = (Line, LsKeys) => CuocGoi.DIENTHOAI_LayCacIDCuocGoiKetThuc_Khac(LsKeys, Line);
                #endregion

                grvCuocKhachLineKhac.LoadAll();
                grvChoGiaiQuyet.LoadAll();
                grvChoGiaiQuyet.StartRealTime();
                #endregion

                #region === Form Input ===
                formInput = new frmDienThoaiInputDataNew_V3(RealTimeEnvironment.ListDataAutoComplete, false, RealTimeEnvironment.DMVung_GPS);

                formInput.OKCloseFormEvent    += SaveData_Click;
                formInput.HienThiCuocMoiEvent += g_frmInput_HienThiCuocMoiEvent;
                formInput.GetTimeServerEvent  += g_frmInput_GetTimeServerEvent;
                formInput.EventCallOut        += g_frmInput_EventCallOut;
                #endregion

                IsShowCommandHelp    = GetHelpCommand();
                panelTopHelp.Visible = IsShowCommandHelp;

                if (!CheckIn())
                {
                    Application.Exit();
                }
            }
            else
            {
                MessageBox.Show(this, "Có lỗi kết nối máy chủ, cần liên lạc với quản trị.",
                                "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }