private void FrmManagerCommand_FormClosed(object sender, FormClosedEventArgs e)
 {
     RealTimeEnvironment.ResetCommand();
     if (IsChangeOrder)
     {
         this.DialogResult = DialogResult.Yes;
     }
 }
Example #2
0
 private void bbtnQuanLyTamLenhModule_ItemClick(object sender, ItemClickEventArgs e)
 {
     using (var item = new FrmCommandModule())
     {
         item.ShowDialog();
         if (item.IsChangeCommand)
         {
             RealTimeEnvironment.ResetCommand();
             panelTopHelp.Controls.Clear();
             GetHelpCommand();
         }
     }
 }
Example #3
0
        private void FrmTestRealTimeGridView_Load(object sender, EventArgs e)
        {
            RealTimeEnvironment.IniRealTime();


            dienThoaiGridView1.FuncGetTimerServer = CommonBL.GetTimeServer;
            dienThoaiGridView1.FuncGetAll         = CuocGoi.G5_DIENTHOAI_LayAllCuocGoi;
            dienThoaiGridView1.FuncGetNew         = CuocGoi.G5_DIENTHOAI_LayDSCuocGoiMoi_FT;
            dienThoaiGridView1.FuncGetUpdate      = CuocGoi.G5_DIENTHOAI_LayDSCuocGoiThayDoiByTongDai;
            dienThoaiGridView1.FuncGetDelete      = (Line, LsKeys) => CuocGoi.G5_DIENTHOAI_LayCacIDCuocGoiKetThucByTongDai(LsKeys, Line);
            dienThoaiGridView1.LoadAll();
            dienThoaiGridView1.ActionPopUp     += dienThoaiGridView1_ActionPopUp;
            dienThoaiGridView1.EventActionStep += dienThoaiGridView1_EventActionStep;
            dienThoaiGridView1.StartRealTime();

            dienThoaiGridView2.FuncGetTimerServer = CommonBL.GetTimeServer;
            dienThoaiGridView2.FuncGetAll         = CuocGoi.G5_DIENTHOAI_LayAllCuocGoi;
            dienThoaiGridView2.FuncGetNew         = CuocGoi.G5_DIENTHOAI_LayDSCuocGoiMoi_FT;
            dienThoaiGridView2.FuncGetUpdate      = CuocGoi.G5_DIENTHOAI_LayDSCuocGoiThayDoiByTongDai;
            dienThoaiGridView2.FuncGetDelete      = (Line, LsKeys) => CuocGoi.G5_DIENTHOAI_LayCacIDCuocGoiKetThucByTongDai(LsKeys, Line);
            dienThoaiGridView2.LoadAll();
            var testdb = RealTimeEnvironment.DicCommand;

            //for (int i = 0; i < 10; i++)
            //{
            #region ===Gen label command===
            List <G5Command> lst = testdb;
            int rowCount         = 4;
            if (lst.Count > 0)
            {
                int       mod         = lst.Count % rowCount;
                int       indexCMD    = 0;
                int       columnCount = mod == 0 ? lst.Count / rowCount : lst.Count / rowCount + 1;
                DataTable dt          = new DataTable();
                for (int i = 0; i < columnCount; i++)
                {
                    dt.Columns.Add(i.ToString(), typeof(string));
                }
                for (int i = 0; i < rowCount; i++)
                {
                    DataRow dr = dt.NewRow();
                    dt.Rows.Add(dr);
                }
                for (int j = 0; j < columnCount; j++)
                {
                    for (int i = 0; i < rowCount; i++)
                    {
                        if (indexCMD + i > lst.Count)
                        {
                            break;
                        }
                        dt.Rows[i][j] = string.Format("Phím {0}\t: {1}", (char)lst[indexCMD].Shortcuts, lst[indexCMD].Command);
                        indexCMD++;
                        if (indexCMD >= lst.Count)
                        {
                            break;
                        }
                    }
                }
                grvCommand.DataSource = dt;

                grvCommand.Visible = true;
                grvCommand.Width   = grvCommand.Columns.GetColumnsWidth(DataGridViewElementStates.Visible);
                Screen scr = Screen.PrimaryScreen;
                grvCommand.Left = (scr.WorkingArea.Width - this.Width) / 2 + this.Width - grvCommand.Width;
                grvCommand.Top  = (scr.WorkingArea.Height - this.Height) / 2 + this.Height - grvCommand.Height;
                // grvCommand.Location = new Point(this.Width = grvCommand.Width,ribbonControl1.Width- grvCommand.Height);
                grvCommand.Rows[0].Cells[0].Selected = false;
            }
            else
            {
                grvCommand.Visible = false;
            }
            #endregion
            var start   = DateTime.Now;
            int row     = 0;
            int col     = 0;
            int height  = 1;
            int with    = 10;
            int withMax = 0;
            for (int i1 = 0; i1 < testdb.Count; i1++)
            {
                if (row > 3)
                {
                    row     = 0;
                    col     = col + 1;
                    with    = with + withMax + 3;
                    withMax = 0;
                }
                var cmd = testdb[i1];
                var lbl = new Label();
                lbl.Text = string.Format("Phím {0}\t : {1}", cmd.Shortcuts, cmd.Command);
                panelHelpCommand.Controls.Add(lbl);
                lbl.Location = new Point(with, (lbl.Height + height) * row + height);
                if (lbl.Width > withMax)
                {
                    withMax = lbl.Width;
                }
                row++;
            }
            panelHelpCommand.Width = with + withMax;
        }
Example #4
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();
            }
        }