private void ProcessorOnOnProcessStateChange(eServiceStatus status, string processState)
        {
            TabControl tabMain    = MainIbetSboForm.Controls.Find("tabMain", true).FirstOrDefault() as TabControl;
            TabPage    currentTab = tabMain.TabPages[ID.ToString()];

            this.Invoke((MethodInvoker) delegate()
            {
                currentTab.Text = processState;
                if (processState != "reconnecting...")
                {
                    var sboProfile         = SboEngine.GetAccountProfile();
                    lblSboStatus.Text      = SboEngine.AccountStatus.ToString();
                    lblSboRealDomain.Text  = sboProfile.UrlHost;
                    lblSboCreadit.Text     = sboProfile.AvailabeCredit.ToString();
                    lblSboCashBalance.Text = sboProfile.CashBalance.ToString();

                    var ibetProfile         = IbetEngine.GetAccountProfile();
                    lblIbetStatus.Text      = IbetEngine.AccountStatus.ToString();
                    lblIbetRealDomain.Text  = ibetProfile.UrlHost;
                    lblIbetCreadit.Text     = ibetProfile.AvailabeCredit.ToString();
                    lblIbetCashBalance.Text = ibetProfile.CashBalance.ToString();
                }
            });
        }
        private void CheckInfoStatus(object sender, ElapsedEventArgs e)
        {
            try
            {
                var ibetProfile = IbetEngine.GetAccountProfile();

                if (ibetProfile.AvailabeCredit == 0)
                {
                    this.StopProcessor();
                    this.SetStartClickStyle();

                    Thread thread = new Thread(() => this.Processor.ReStart());
                    thread.SetApartmentState(ApartmentState.STA);
                    thread.Start();

                    return;
                }
                else
                {
                    this.Invoke((MethodInvoker) delegate
                    {
                        lblIbetStatus.Text      = IbetEngine.AccountStatus.ToString();
                        lblIbetRealDomain.Text  = IbetEngine.Host;
                        lblIbetCreadit.Text     = ibetProfile.AvailabeCredit.ToString();
                        lblIbetCashBalance.Text = ibetProfile.CashBalance.ToString();
                    });
                }
            }
            catch (Exception ex)
            {
                this.StopProcessor();
            }

            try
            {
                var sboProfile = SboEngine.GetAccountProfile();

                if (sboProfile.AvailabeCredit == 0)
                {
                    this.StopProcessor();
                    this.SetStartClickStyle();
                    Thread thread = new Thread(() => this.Processor.ReStart());
                    thread.SetApartmentState(ApartmentState.STA);
                    thread.Start();
                }
                else
                {
                    this.Invoke((MethodInvoker) delegate
                    {
                        lblSboStatus.Text      = SboEngine.AccountStatus.ToString();
                        lblSboRealDomain.Text  = SboEngine.Host;
                        lblSboCreadit.Text     = sboProfile.AvailabeCredit.ToString();
                        lblSboCashBalance.Text = sboProfile.CashBalance.ToString();
                    });
                }
            }
            catch (Exception ex)
            {
                this.StopProcessor();
            }
        }
        public void StartProcessor()
        {
            if (!rdoMax.Checked && string.IsNullOrEmpty(txtBetStake.Text))
            {
                return;
            }

            SetProcessingStyle();

            if (IbetEngine.AccountStatus == eAccountStatus.Offline)
            {
                LoginIbet();
            }

            if (SboEngine.AccountStatus == eAccountStatus.Offline)
            {
                LoginSbo();
            }

            TabControl tabMain    = MainIbetSboForm.Controls.Find("tabMain", true).FirstOrDefault() as TabControl;
            TabPage    currentTab = tabMain.TabPages[ID.ToString()];

            if (SboEngine.AccountStatus == eAccountStatus.Online &&
                IbetEngine.AccountStatus == eAccountStatus.Online)
            {
                this.Invoke((MethodInvoker) delegate()
                {
                    scanType                      = (eScanType)cboMarket.SelectedIndex;
                    Processor.IbetEngine          = IbetEngine;
                    Processor.SboEngine           = SboEngine;
                    Processor.ProcessorConfigInfo = ProcessBindData();

                    if (Processor.Start(scanType) == eServiceStatus.Started)
                    {
                        //currentTab.Text = Processor.ProcessorName;

                        var sboProfile         = SboEngine.GetAccountProfile();
                        lblSboStatus.Text      = SboEngine.AccountStatus.ToString();
                        lblSboRealDomain.Text  = sboProfile.UrlHost;
                        lblSboCreadit.Text     = sboProfile.AvailabeCredit.ToString();
                        lblSboCashBalance.Text = sboProfile.CashBalance.ToString();

                        var ibetProfile         = IbetEngine.GetAccountProfile();
                        lblIbetStatus.Text      = IbetEngine.AccountStatus.ToString();
                        lblIbetRealDomain.Text  = ibetProfile.UrlHost;
                        lblIbetCreadit.Text     = ibetProfile.AvailabeCredit.ToString();
                        lblIbetCashBalance.Text = ibetProfile.CashBalance.ToString();
                        StartCheckStatus();
                        SetStartClickStyle();

                        ////TODO:QUOCLE: REM TO TEST
                        if (_driver.Status != eServiceStatus.Started && DataContainer.HasLocalScan)
                        {
                            Thread thread = new Thread(StartDriver);
                            thread.SetApartmentState(ApartmentState.STA);
                            thread.Start();
                        }

                        if (OnAccountSatus != null)
                        {
                            OnAccountSatus(Code, true);
                        }
                    }
                    else
                    {
                        //Quang msgbox start ko thanh cong
                        if (Processor.StartFailCount >= 3)
                        {
                            currentTab.Text = "FAIL (Force STOP)";
                            StopProcessor();
                        }
                        else
                        {
                            currentTab.Text = "FAIL";
                            SetDefaultStyle();
                        }
                    }
                });

                //Processor.OnLogScanEvent += dashboard.OnLogScanEvent;
                //Processor.OnProcessExceptionEvent += dashboard.OnProcessorExceptionEvent;
                //Processor.OnUpdateCredit += dashboard.OnUpdateCredit;
            }
            else
            {
                SetDefaultStyle();
            }
        }