Exemplo n.º 1
0
 public void Start(eScanType scanType)
 {
     IsReConnect = false;
     Status      = eServiceStatus.Started;
     ScanType    = scanType;
     StartSbo();
     //StartIbet(ibetUrl);
 }
Exemplo n.º 2
0
        private void pbPlay_Click(object sender, EventArgs e)
        {
            eScanType scanType = (eScanType)cboMarket.SelectedIndex;

            SetPlayClickStyle();
            Guid guidProcessor = _accountConfig.InitProcessor(this);

            _accountConfig.StartProcessor(this, guidProcessor, scanType);
        }
Exemplo n.º 3
0
        public void StartProcessor(Dashboard dashboard, Guid processGuid, eScanType scanType)
        {
            //int countLogin = 0;
            //update Main Tab Name
            TabControl tabMain    = _bcWin.Controls.Find("tabMain", true).FirstOrDefault() as TabControl;
            TabPage    currentTab = tabMain.SelectedTab;

            currentTab.Text = txtFirstAccountName.Text + " - " + txtSecondAccountName.Text;
            //if (tabMain.SelectedTab.Name.StartsWith("Ibet_Sbo"))
            //{
            //    TabPage currentTab = tabMain.SelectedTab;
            //    //currentTab.Name = processGuid.ToString();
            //    currentTab.Text = txtFirstAccountName.Text + " - " + txtSecondAccountName.Text;
            //}


            //processor.Initialize();

            if (IsAccountFirstLogged && IsAccountSecondLogged)//Check da login 2 ben chua
            {
                Processor.IbetEngine          = this.IbetEngine;
                Processor.SboEngine           = this.SboEngine;
                Processor.ProcessorConfigInfo = ProcessBindData();

                if (Processor.Start(scanType) == Common.Objects.eServiceStatus.Started)
                {
                    //webBrowserIbet.Navigate("about:blank");
                    webBrowserSbo.Navigate("about:blank");
                }
                else
                {
                    //Quang msgbox start ko thanh cong
                    if (Processor.StartFailCount >= 3)
                    {
                        DialogResult result = MessageBox.Show("Khởi động máy quét vượt quá số lần cho phép. Vui lòng bấm OK để đăng nhập lại.", "Lỗi khởi động máy quét", MessageBoxButtons.OK);
                        if (result == DialogResult.OK)
                        {
                            StopProcessor();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Lỗi xảy ra khi khởi động máy quét.", "Lỗi.");
                        dashboard.SetDefaultStyle();
                    }
                    //countLogin++;
                }
            }
            else
            {
                MessageBox.Show("Tài khoản chưa đăng nhập. Vui lòng kiểm tra lại.", "Lỗi đăng nhập.");
                dashboard.SetDefaultStyle();
            }
        }
Exemplo n.º 4
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            //5c8c3e5a7fb0ef40406cc6f5962be464
            //if (string.IsNullOrEmpty(txtSellEx.Text) || string.IsNullOrEmpty(txtBuyEx.Text))
            //{
            //    MessageBox.Show("Nhập thiếu thông tin!");
            //    return;
            //}

            UpdateLogText("Đang kết nối server....................", eLogTextType.Warning);
            var key = _manageService.GetKey();

            if (key != "5c8c3e5a7fb0ef40406cc6f5962be464")
            {
                UpdateLogText("Lỗi parse data. Kết nối server thất bai. Không thể khởi động tài khoản scan.", eLogTextType.Error);
                return;
            }

            Task.Run(() =>
            {
                this.Invoke((MethodInvoker)(() =>
                {
                    scanType = (eScanType)cboMarket.SelectedIndex;
                    Random r = new Random();
                    var url = DataContainer.SboScanServers[r.Next(DataContainer.SboScanServers.Count())];
                    sboScan.IpFake = txtIpFakeScan.Text;
                    sboScan.Login(url, txtUserscan.Text.Trim(), txtPassScan.Text.Trim());
                    if (sboScan.AccountStatus == eAccountStatus.Online)
                    {
                        sboScan.StartBetRunEngine(scanType, false);
                        buyExchange = int.Parse(txtBuyEx.Text);
                        sellExchange = int.Parse(txtSellEx.Text);
                        txtUserscan.Enabled = false;
                        txtPassScan.Enabled = false;
                        btnStart.Enabled = false;
                        //txtBuyEx.Enabled = false;
                        maxStakeCompare = (int)numMaxStake.Value;
                        numMaxStake.Enabled = false;
                        cboMarket.Enabled = false;
                        txtIpFakeScan.Enabled = false;
                        //txtSellEx.Enabled = false;
                        //dgvUserBuy.Enabled = true;
                        //dgvUserSell.Enabled = true;

                        UpdateLogText("Kết nối server thành công!");
                    }
                    else
                    {
                        UpdateLogText("Kết nối server thất bai.", eLogTextType.Error);
                    }
                }));
            });
        }
Exemplo n.º 5
0
        private void btnIbetSboStart_Click(object sender, EventArgs e)
        {
            this.Invoke((MethodInvoker) delegate()
            {
                lblStartTime.Text       = DateTime.Now.ToString();
                lblUsername.Text        = SelfInfo.Username;
                btnIbetSboStart.Enabled = false;
            });

            eScanType scanType = (eScanType)cboMarket.SelectedIndex;

            Process.Driver.ManageService = _manageService;
            System.Timers.Timer timerPing = new System.Timers.Timer(60000 * 2);
            timerPing.Elapsed += PingManage;
            timerPing.Start();

            StartDriver(scanType);
        }
Exemplo n.º 6
0
        public void Start(eScanType scanType)
        {
            Status   = eServiceStatus.Started;
            ScanType = scanType;
            //DataContainer.SourceIpFakes = IpData.SourceIp;

            if (ScanData.IpAddress != null && ScanData.IpAddress.Any())
            {
                _useRealIp = true;
            }

            StartLoginSbo();

            StartIbet();

            StartSbo();

            Logger.Info("KHOI DONG SCAN THANH CONG!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
        }
Exemplo n.º 7
0
        public void StartScanEngine(eScanType scanType)
        {
            switch (scanType)
            {
            case eScanType.Live:
                StartScanLive();
                break;

            case eScanType.NonLive:
                StartScanNonLive();
                break;

            case eScanType.All:
                StartScanLive();
                StartScanNonLive();
                break;
            }

            //EngineLogger = new EngineLogger(EngineName) { ServerType = eServerType.Ibet };
            ScanType = scanType;
            Logger.Info("STARTED: " + UrlHost);
            Status = eServiceStatus.Started;
        }
Exemplo n.º 8
0
        public void StartProcessor()
        {
            if (!rdoMax.Checked && string.IsNullOrEmpty(txtBetStake.Text))
            {
                this.Invoke((MethodInvoker) delegate()
                {
                    this.lblStatus.Visible = true;
                    this.lblStatus.Text    = "Lỗi cầu hình tiền cược!";
                });

                return;
            }

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

            SetProcessingStyle();

            if (Processor.PiEngine.AccountStatus == eAccountStatus.Offline)
            {
                LoginPina();
            }

            if (Processor.IsnEngine.AccountStatus == eAccountStatus.Offline)
            {
                LoginIsn();
            }



            if (Processor.IsnEngine.AccountStatus == eAccountStatus.Online &&
                Processor.PiEngine.AccountStatus == eAccountStatus.Online)
            {
                this.Invoke((MethodInvoker) delegate()
                {
                    eScanType scanType = (eScanType)cboMarket.SelectedIndex;

                    Processor.ProcessorConfigInfo = ProcessBindData();

                    if (Processor.Start(scanType) == eServiceStatus.Started)
                    {
                        var sboProfile = Processor.IsnEngine.GetAccountProfile();
                        if (sboProfile != null)
                        {
                            lblSboCreadit.Text     = sboProfile.betCredit.ToString();
                            lblSboCashBalance.Text = sboProfile.cashBalance.ToString();
                        }
                        lblSboStatus.Text = Processor.IsnEngine.AccountStatus.ToString();

                        lblSboRealDomain.Text = "http://isn01.com/";


                        //var ibetProfile = Processor.PiEngine.GetAccountProfile();
                        lblIbetStatus.Text = Processor.PiEngine.AccountStatus.ToString();
                        //lblIbetRealDomain.Text = ibetProfile.UrlHost;
                        lblIbetCreadit.Text = Processor.PiEngine.AvailabeCredit.ToString();
                        //lblIbetCashBalance.Text = Processor.PiEngine.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
                    {
                        if (Processor.StartFailCount >= 3)
                        {
                            currentTab.Text = "FAIL (Force STOP)";
                            StopProcessor();
                        }
                        else
                        {
                            currentTab.Text = "FAIL";
                            SetDefaultStyle();
                        }
                    }
                });
            }
            else
            {
                SetDefaultStyle();
            }
        }
Exemplo n.º 9
0
        public eServiceStatus Start(eScanType scanType)
        {
            CompareValueDifferent = ProcessorConfigInfo.CompareValue;
            ScanType           = scanType;
            CountBet           = 1;
            MaxCountBet        = ProcessorConfigInfo.MaxCountBet;
            LastBetTime        = DateTime.Now.AddMinutes(-10);
            LastBetIbetSuccess = DateTime.Now.AddMinutes(-10);

            BetStakeType     = ProcessorConfigInfo.BetStakeType;
            BetStake         = ProcessorConfigInfo.BetStake;
            TimeOffStakeOdds = ProcessorConfigInfo.TimeOffStakeOdds;
            MinOddDefBet     = ProcessorConfigInfo.MinOddDefBet;
            MinTimeToBet     = ProcessorConfigInfo.MinTimeToBet;

            BetAgainstIbet       = ProcessorConfigInfo.RebetIbet;
            WaitingTimeRebetIbet = ProcessorConfigInfo.WaitingTimeRebetIbet;
            AcceptMinLossIbet    = ProcessorConfigInfo.AcceptMinLossIbet;

            if (ProcessorConfigInfo.AccountFirst.ServerType == eServerType.Ibet)
            {
                IbetMaxStakeMatch = ProcessorConfigInfo.AccountFirst.MaxStake;
                IbetRateExchange  = ProcessorConfigInfo.AccountFirst.RateExchange;
                SboMaxStakeMatch  = ProcessorConfigInfo.AccountSecond.MaxStake;
                SboRateExchange   = ProcessorConfigInfo.AccountSecond.RateExchange;
            }
            else
            {
                IbetMaxStakeMatch = ProcessorConfigInfo.AccountSecond.MaxStake;
                IbetRateExchange  = ProcessorConfigInfo.AccountSecond.RateExchange;
                SboMaxStakeMatch  = ProcessorConfigInfo.AccountFirst.MaxStake;
                SboRateExchange   = ProcessorConfigInfo.AccountFirst.RateExchange;
            }

            try
            {
                Initialize();
                ProcessorName = IbetEngine.UserName + " - " + SboEngine.UserName;
                //EngineLogger engineLogger = new EngineLogger(engineName);

                //if (SboEngine.CheckLogin() && IbetEngine.CheckLogin())
                //{
                SboEngine.EngineName = ProcessorName;
                //SboEngine.EngineLogger = engineLogger;
                SboEngine.Rebet = ProcessorConfigInfo.RebetSbo;
                //SboEngine.InitEngine();
                SboEngine.UpdateAvailabeCredit();
                SboEngine.StartScanEngine(scanType);

                //IbetEngine.InitEngine();
                IbetEngine.EngineName = ProcessorName;
                //IbetEngine.EngineLogger = engineLogger;
                IbetEngine.UpdateAvailabeCredit();
                IbetEngine.StartScanEngine(scanType);

                objUpdateCreditTimer = new Timer(WaitUpdateCreditCallback, null, 60000 * 5, 60000 * 5);
                StartFailCount       = 0;

                //IbetSboDriver.OnSboScanUpdate += IbetSboDriverOnUpdateScan;
                ServerCallback.OnSboScanUpdate  += OnSboUpdateScan;
                ServerCallback.OnIbetScanUpdate += OnIbetUpdateScan;
                FireProcessStateChange(eServiceStatus.Started, ProcessorName);
                Status = eServiceStatus.Started;
                //}

                // return eServiceStatus.Unknown;
            }
            catch (Exception ex)
            {
                Logger.Error("Start Processor Fail !", ex);

                StartFailCount++;

                SboEngine.Dispose();
                SboEngine.Dispose();
                Status = eServiceStatus.Unknown;
            }

            return(Status);
        }
Exemplo n.º 10
0
        public eServiceStatus Start(eScanType scanType)
        {
            CompareValueDifferent = ProcessorConfigInfo.CompareValue;
            //CompareValueDifferent = ProcessorConfigInfo.CompareValue + 0.005;
            ScanType    = scanType;
            CountBet    = 1;
            MaxCountBet = ProcessorConfigInfo.MaxCountBet;
            LastBetTime = DateTime.Now.AddMinutes(-10);

            BetStakeType = ProcessorConfigInfo.BetStakeType;
            Stake        = ProcessorConfigInfo.BetStake;

            BetStake = new List <int>();
            var stak = Stake.Split(new[] { '#' });

            foreach (var s in stak)
            {
                if (!string.IsNullOrEmpty(s))
                {
                    int stake;
                    int.TryParse(s, out stake);
                    if (stake != 0)
                    {
                        //Logger.Info("STAKE " + stake);
                        BetStake.Add(stake);
                    }
                }
            }

            BetStake.Shuffle();


            TimeOffStakeOdds = ProcessorConfigInfo.TimeOffStakeOdds;
            MinOddDefBet     = ProcessorConfigInfo.MinOddDefBet;
            MinTimeToBet     = ProcessorConfigInfo.MinTimeToBet;

            BetAgainstIbet    = ProcessorConfigInfo.RebetIbet;
            AcceptMinLossIbet = ProcessorConfigInfo.AcceptMinLossIbet;

            if (ProcessorConfigInfo.AccountFirst.ServerType == eServerType.Pina)
            {
                IbetMaxStakeMatch = ProcessorConfigInfo.AccountFirst.MaxStake;
                IbetRateExchange  = ProcessorConfigInfo.AccountFirst.RateExchange;
                SboMaxStakeMatch  = ProcessorConfigInfo.AccountSecond.MaxStake;
                SboRateExchange   = ProcessorConfigInfo.AccountSecond.RateExchange;
            }
            else
            {
                IbetMaxStakeMatch = ProcessorConfigInfo.AccountSecond.MaxStake;
                IbetRateExchange  = ProcessorConfigInfo.AccountSecond.RateExchange;
                SboMaxStakeMatch  = ProcessorConfigInfo.AccountFirst.MaxStake;
                SboRateExchange   = ProcessorConfigInfo.AccountFirst.RateExchange;
            }

            try
            {
                Initialize();
                ProcessorName = PiEngine.UserName + " - " + IsnEngine.UserName;

                IsnEngine.EngineName = ProcessorName;
                IsnEngine.Rebet      = ProcessorConfigInfo.RebetSbo;
                IsnEngine.UpdateAvailabeCredit();
                IsnEngine.StartScanEngine(scanType);

                PiEngine.Rebet      = ProcessorConfigInfo.RebetSbo;
                PiEngine.EngineName = ProcessorName;
                PiEngine.UpdateAvailabeCredit();
                PiEngine.StartScanEngine(scanType);

                objUpdateCreditTimer = new Timer(WaitUpdateCreditCallback, null, 60000 * 5, 60000 * 5);
                StartFailCount       = 0;

                IsnEngine.UpdateLiveDataChange += OnIsnUpdateScan;

                //tạm đóng
                //PiSboDriver.OnSboScanUpdate += PiSboDriver_OnSboScanUpdate;
                //_driver.OnSboScanUpdate += OnSboUpdateScan;

                FireProcessStateChange(eServiceStatus.Started, ProcessorName);
                Status = eServiceStatus.Started;
            }
            catch (Exception ex)
            {
                Logger.Error("Start Processor Fail !", ex);

                StartFailCount++;

                PiEngine.Dispose();
                IsnEngine.Dispose();
                Status = eServiceStatus.Unknown;
            }

            return(Status);
        }
Exemplo n.º 11
0
        public eServiceStatus Start(eScanType scanType)
        {
            CompareValueDifferent = ProcessorConfigInfo.CompareValue;
            ScanType           = scanType;
            CountBet           = 1;
            MaxCountBet        = ProcessorConfigInfo.MaxCountBet;
            LastBetTime        = DateTime.Now.AddMinutes(-10);
            LastBetIbetSuccess = DateTime.Now.AddMinutes(-10);

            BetStakeType = ProcessorConfigInfo.BetStakeType;
            Stake        = ProcessorConfigInfo.BetStake;

            BetStake = new List <int>();
            var stak = Stake.Split(new[] { '#' });

            foreach (var s in stak)
            {
                if (!string.IsNullOrEmpty(s))
                {
                    int stake;
                    int.TryParse(s, out stake);
                    if (stake != 0)
                    {
                        //Logger.Info("STAKE " + stake);
                        BetStake.Add(stake);
                    }
                }
            }

            BetStake.Shuffle();


            TimeOffStakeOdds = ProcessorConfigInfo.TimeOffStakeOdds;
            MinOddDefBet     = ProcessorConfigInfo.MinOddDefBet;
            MinTimeToBet     = ProcessorConfigInfo.MinTimeToBet;

            BetAgainstIbet = ProcessorConfigInfo.RebetIbet;
            //WaitingTimeRebetIbet = ProcessorConfigInfo.WaitingTimeRebetIbet;
            AcceptMinLossIbet = ProcessorConfigInfo.AcceptMinLossIbet;

            if (ProcessorConfigInfo.AccountFirst.ServerType == eServerType.Ibet)
            {
                IbetMaxStakeMatch = ProcessorConfigInfo.AccountFirst.MaxStake;
                IbetRateExchange  = ProcessorConfigInfo.AccountFirst.RateExchange;
                SboMaxStakeMatch  = ProcessorConfigInfo.AccountSecond.MaxStake;
                SboRateExchange   = ProcessorConfigInfo.AccountSecond.RateExchange;
            }
            else
            {
                IbetMaxStakeMatch = ProcessorConfigInfo.AccountSecond.MaxStake;
                IbetRateExchange  = ProcessorConfigInfo.AccountSecond.RateExchange;
                SboMaxStakeMatch  = ProcessorConfigInfo.AccountFirst.MaxStake;
                SboRateExchange   = ProcessorConfigInfo.AccountFirst.RateExchange;
            }

            try
            {
                Initialize();
                ProcessorName = IbetEngine.UserName + " - " + SboEngine.UserName;
                //EngineLogger engineLogger = new EngineLogger(engineName);

                //if (SboEngine.CheckLogin() && PiEngine.CheckLogin())
                //{
                SboEngine.EngineName = ProcessorName;
                //SboEngine.EngineLogger = engineLogger;
                SboEngine.Rebet = ProcessorConfigInfo.RebetSbo;
                //SboEngine.InitEngine();
                SboEngine.UpdateAvailabeCredit();
                SboEngine.StartScanEngine(scanType);

                //PiEngine.InitEngine();
                IbetEngine.EngineName = ProcessorName;
                //PiEngine.EngineLogger = engineLogger;
                IbetEngine.UpdateAvailabeCredit();
                IbetEngine.StartScanEngine(scanType);

                objUpdateCreditTimer = new Timer(WaitUpdateCreditCallback, null, 60000 * 5, 60000 * 5);
                StartFailCount       = 0;

                _driver.OnSboScanUpdate += OnSboUpdateScan;

                //SboEngine.UpdateLiveDataChange += SboEngineOnUpdateLiveDataChange;
                //IbetSboDriver.OnSboScanUpdate += OnSboUpdateScan;
                //ServerCallback.OnSboScanUpdate += OnSboUpdateScan;
                //ServerCallback.OnIbetScanUpdate += OnIbetUpdateScan;
                ServerCallback.OnTransactionStatic += ServerCallback_OnTransaction;
                FireProcessStateChange(eServiceStatus.Started, ProcessorName);
                Status = eServiceStatus.Started;

                //List<TransactionDTO> transactionDtos;
                //while (TransactionQueue.TryDequeue(out transactionDtos))
                //{
                //    // do nothing
                //}
                //processBetThread = new Thread(DoBetTransaction);
                //processBetThread.Start();
                //}

                // return eServiceStatus.Unknown;
            }
            catch (Exception ex)
            {
                Logger.Error("Start Processor Fail !", ex);

                StartFailCount++;

                SboEngine.Dispose();
                SboEngine.Dispose();
                Status = eServiceStatus.Unknown;
            }

            return(Status);
        }
Exemplo n.º 12
0
 private void StartDriver(eScanType scanType)
 {
     Process.Driver.Start(scanType);
 }
        public eServiceStatus Start(eScanType scanType)
        {
            CompareValueDifferent = ProcessorConfigInfo.CompareValue;

            CountBet         = 1;
            MaxCountBet      = ProcessorConfigInfo.MaxCountBet;
            LastBetTime      = DateTime.Now;
            BetStakeType     = ProcessorConfigInfo.BetStakeType;
            BetStake         = ProcessorConfigInfo.BetStake;
            TimeOffStakeOdds = ProcessorConfigInfo.TimeOffStakeOdds;
            if (ProcessorConfigInfo.AccountFirst.ServerType == eServerType.Ibet)
            {
                IbetMaxStakeMatch = ProcessorConfigInfo.AccountFirst.MaxStake;
                IbetRateExchange  = ProcessorConfigInfo.AccountFirst.RateExchange;
                SboMaxStakeMatch  = ProcessorConfigInfo.AccountSecond.MaxStake;
                SboRateExchange   = ProcessorConfigInfo.AccountSecond.RateExchange;
            }
            else
            {
                IbetMaxStakeMatch = ProcessorConfigInfo.AccountSecond.MaxStake;
                IbetRateExchange  = ProcessorConfigInfo.AccountSecond.RateExchange;
                SboMaxStakeMatch  = ProcessorConfigInfo.AccountFirst.MaxStake;
                SboRateExchange   = ProcessorConfigInfo.AccountFirst.RateExchange;
            }

            try
            {
                Initialize();
                var engineName = IbetEngine.UserName + " - " + SboEngine.UserName;
                //EngineLogger engineLogger = new EngineLogger(engineName);

                //if (SboEngine.CheckLogin() && IbetEngine.CheckLogin())
                //{
                SboEngine.EngineName = engineName;
                //SboEngine.EngineLogger = engineLogger;
                SboEngine.Rebet = ProcessorConfigInfo.RebetSbo;
                //SboEngine.InitEngine();
                SboEngine.UpdateAvailabeCredit();
                SboEngine.StartScanEngine(scanType);

                //IbetEngine.InitEngine();
                IbetEngine.EngineName = engineName;
                //IbetEngine.EngineLogger = engineLogger;
                IbetEngine.UpdateAvailabeCredit();
                IbetEngine.StartScanEngine(scanType);

                objUpdateCreditTimer = new Timer(WaitUpdateCreditCallback, null, 60000 * 5, 60000 * 5);
                StartFailCount       = 0;
                Status = eServiceStatus.Started;
                //}

                // return eServiceStatus.Unknown;
            }
            catch (Exception ex)
            {
                Logger.Error("Start Processor Fail !", ex);

                StartFailCount++;

                SboEngine.Dispose();
                SboEngine.Dispose();
                Status = eServiceStatus.Unknown;
            }

            return(Status);

            //else
            //{
            //    StartServerFault startServerFault = new StartServerFault();
            //    startServerFault.ServerID = IbetEngine.Account.GuidID;
            //    startServerFault.Message = "Login Fail !";
            //    throw new FaultException<StartServerFault>(startServerFault);
            //}
        }
Exemplo n.º 14
0
        public void MeasureScan(List <string> pathname, List <PointF> pos
                                , eScanType scan_type, int measureDistance
                                , Bitmap mymap, double[] die_size, int threshold)
        {
            MeasureOK = false;
            Alignment(mymap, die_size, threshold);
            if (!AlignmentOK)
            {
                return;
            }
            char[]   axisZ               = { 'Z' };
            char[]   axisXY              = { 'X', 'Y' };
            char[]   axisXYZ             = { 'X', 'Y', 'Z' };
            double[] CLStoBaslerDistance = { -40200 };


            try
            {
                MoveEventArgs moveEventArgs;
                moveEventArgs = new MoveEventArgs(axisZ, CLStoBaslerDistance, _motion.GetAxisDefaultSpeed(axisZ), false);
                AsyncMove(this, moveEventArgs);
                AsyncMoveWait();
                for (int i = 0; i < pos.Count; i++)
                {
                    ScanFileName  = pathname[i];
                    ScanFileIndex = i;
                    _log.Debug("MeasureScan filename:" + ScanFileName);
                    double[] distance = { pos[i].X, pos[i].Y };
                    moveEventArgs = new MoveEventArgs(axisXY, distance, _motion.GetAxisDefaultSpeed(axisXY), false);
                    AsyncMove(this, moveEventArgs);
                    AsyncMoveWait();
                    _camera.SaveImage(pathname + ".bmp");
                    double[] relative2Measure = { _paraReader.RelToMeasureCameraX
                                                  , _paraReader.RelToMeasureCameraY };//放外面relative2Measure經過一次for loop會*10倍
                    moveEventArgs = new MoveEventArgs(axisXY, relative2Measure, _motion.GetAxisDefaultSpeed(axisXY), true);
                    AsyncMove(this, moveEventArgs);
                    AsyncMoveWait();
                    moveEventArgs = new MoveEventArgs('X', _paraReader.RelToMeasureCameraX, _motion.GetAxisDefaultSpeed('X'), true);
                    EncoderSet.Reset();
                    ScanParamSet(this, moveEventArgs);
                    EncoderSet.WaitOne();
                    if (EncoderParamSetOk)
                    {
                        DataSaved.Reset();
                        if (scan_type == eScanType.Scan5Um)
                        {
                            AsyncMove5um(measureDistance);
                        }
                        else
                        {
                            AsyncMove1um(measureDistance);
                        }
                        DataSaved.WaitOne();
                    }
                    else
                    {
                        return;
                    }
                }
                MeasureOK = true;
            }
            catch (Exception ex)
            {
                SynOpErrorArgs arg = new SynOpErrorArgs();
                arg.Ex      = ex;
                arg.Message = "MeasureScan()";
                OnError(this, arg);
            }
        }
Exemplo n.º 15
0
        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();
            }
        }