コード例 #1
0
        private void LoadData(RequestEquityCalculatorEventArgs obj)
        {
            try
            {
                ResetAll(null);

                if (obj.IsEmptyRequest)
                {
                    IsEquityCalculatorModeEnabled = true;
                    _currentHandHistory           = null;
                    IsPreflopVisible = IsFlopVisible = IsTurnVisible = IsRiverVisible = false;
                    CurrentStreet    = Street.Null;
                    InitPlayersList();
                    return;
                }

                _currentHandHistory = ServiceLocator.Current.GetInstance <IDataService>().GetGame(obj.GameNumber, obj.PokersiteId);

                if (_currentHandHistory == null)
                {
                    return;
                }

                SetStreetVisibility(_currentHandHistory);
                LoadBoardByCurrentStreet();
                LoadPlayersData(_currentHandHistory);

                EquityCalculatorMode = _currentHandHistory.GameDescription.TableType.Contains(HandHistories.Objects.GameDescription.TableTypeDescription.ShortDeck) ?
                                       EquityCalculatorMode.HoldemSixPlus : EquityCalculatorMode.Holdem;

                IsEquityCalculatorModeEnabled = false;

                var strongestOpponent = CalculateStrongestOpponent(_currentHandHistory, _currentStreet);

                PlayersList.RemoveAll(x =>
                                      _currentHandHistory
                                      .HandActions.Any(a => (a.HandActionType == HandActionType.FOLD) &&
                                                       (a.PlayerName == x.PlayerName)) &&
                                      (x.PlayerName != StorageModel.PlayerSelectedItem?.Name) &&
                                      (x.PlayerName != strongestOpponent));
            }
            catch (ArgumentOutOfRangeException ex)
            {
                LogProvider.Log.Error(this, "Board contains more than 5 cards", ex);
            }
            catch (Exception ex)
            {
                LogProvider.Log.Error(this, "Error during EquityCalculatorViewModel.LoadData()", ex);
            }
        }
コード例 #2
0
        private void Initialize()
        {
            NotificationRequest = new InteractionRequest <INotification>();

            ToEndCommand    = new RelayCommand(ToEnd);
            NextStepCommand = new RelayCommand(NextStep);
            PrevStepCommand = new RelayCommand(PrevStep);
            ToStartCommand  = new RelayCommand(ToStart);
            PlayCommand     = new RelayCommand(StartTimer);
            StopCommand     = new RelayCommand(StopTimer);
            ToStreetCommand = new RelayCommand(ToStreet);

            TwitterOAuthCommand         = new RelayCommand(TwitterOAuthCommandHandler);
            FacebookOAuthCommand        = new RelayCommand(FacebookOAuthCommandHandler);
            HandNoteCommand             = new RelayCommand(HandNoteShow);
            ShowSupportForumsCommand    = new RelayCommand(ShowSupportForums);
            TagHandCommand              = new RelayCommand(TagHand);
            PreviousSessionHandCommand  = new RelayCommand(() => MoveToSessionHand(false));
            NextSessionHandCommand      = new RelayCommand(() => MoveToSessionHand(true));
            OpenEquityCalculatorCommand = new RelayCommand(() =>
            {
                if (CurrentHand == null)
                {
                    return;
                }

                var requestEquityCalculatorEventArgs = new RequestEquityCalculatorEventArgs(CurrentHand.GameNumber, CurrentHand.PokersiteId);
                eventAggregator.GetEvent <RequestEquityCalculatorEvent>().Publish(requestEquityCalculatorEventArgs);

                System.Windows.Application.Current.MainWindow.Topmost = true;
                System.Windows.Application.Current.MainWindow.Topmost = false;
            });

            TableStateList    = new List <ReplayerTableState>();
            PlayersCollection = new ObservableCollection <ReplayerPlayerViewModel>();

            for (int i = 0; i < PLAYERS_COLLECTION_SIZE; i++)
            {
                PlayersCollection.Add(new ReplayerPlayerViewModel());
            }

            timer          = new DispatcherTimer();
            timer.Interval = TimeSpan.FromMilliseconds(TIMER_INTERVAL_MS);
            timer.Tick    += OnTimerTick;

            BBFilter = settingsService.GetSettings().GeneralSettings.ReplayerBBFilter;
        }