private void SessionCallBack(Object o) { try { _elapsedTimer.Change(1000, 1000); switch (CurrentState) { case GameState.PrepareNewRound: var session = Lddb.Instance.CreateSession(MoneyType); if (session == null) { throw new Exception("Init new session error!"); } _createdTime = $"{DateTime.Now.Year.ToString("D4")}{DateTime.Now.Month.ToString("D2")}{DateTime.Now.Day.ToString("D2")}"; if (MoneyType == 1) //event { _isBetKingEvent = Lddb.Instance.IsEventBetKing(); } SessionID = session.SessionId; _dateStatus = session.DateStatus; Ellapsed = Models.Config.TimeConfig[(int)CurrentState]; ThreadPool.QueueUserWorkItem(_ => { try { Clients.Clients.Clients(_connection.GetAll()).SessionInfo(MoneyType, this); } catch { } }); Thread.Sleep(Models.Config.TimeConfig[(int)CurrentState] * 1000); StartBettingPhrase(); StartTimer(); break; case GameState.Betting: Ellapsed = Models.Config.TimeConfig[(int)CurrentState]; ThreadPool.QueueUserWorkItem(_ => { try { Clients.Clients.Clients(_connection.GetAll()).SessionInfo(MoneyType, this); } catch { } }); //BotInstance.StartBotTimer(); if (MoneyType == 1) { _botManager.Bet(); } Thread.Sleep(Models.Config.TimeConfig[(int)CurrentState] * 1000); StartEndBettingPhrase(); StartTimer(); break; case GameState.EndBetting: Ellapsed = Models.Config.TimeConfig[(int)CurrentState]; //ThreadPool.QueueUserWorkItem(_ => { // try // { // Clients.Clients.Clients(_connection.GetAll()).SessionInfo(MoneyType, this); // } // catch // { // } //}); Thread.Sleep(Models.Config.TimeConfig[(int)CurrentState] * 1000); StartShowResultPhrase(); StartTimer(); break; case GameState.ShowResult: Ellapsed = Models.Config.TimeConfig[(int)CurrentState]; ThreadPool.QueueUserWorkItem(_ => { try { Clients.Clients.Clients(_connection.GetAll()).SessionInfo(MoneyType, this); } catch { } }); Thread.Sleep(Models.Config.TimeConfig[(int)CurrentState] * 1000); StartPreparePhrase(); StartTimer(); break; } } catch (Exception ex) { NLogManager.PublishException(ex); StartPreparePhrase(); StartTimer(); } }