public IDetailedStatisticsAnalyzerViewModel InitializeWith(IEnumerable <IAnalyzablePokerPlayer> analyzablePokerPlayers, string playerName) { ViewModelHistory.Clear(); _selectedPlayerHandsBrowser.InitializeWith(analyzablePokerPlayers, playerName); AddViewModel(_selectedPlayerHandsBrowser); return(this); }
void RemoveAllViewModelsInHistoryThatAreBehindCurrentViewModel() { int indexOfCurrentView = ViewModelHistory.IndexOf(CurrentViewModel); if (indexOfCurrentView > -1 && indexOfCurrentView < ViewModelHistory.Count - 1) { int removalIndex = indexOfCurrentView + 1; while (ViewModelHistory.Count > removalIndex) { ViewModelHistory.RemoveAt(removalIndex); } } }
public IDetailedStatisticsAnalyzerViewModel AddViewModel(IDetailedStatisticsAnalyzerContentViewModel viewModel) { if (viewModel.ShowAsPopup) { PopupViewModel = viewModel; ShowPopup = true; return(this); } ShowPopup = false; RemoveAllViewModelsInHistoryThatAreBehindCurrentViewModel(); ViewModelHistory.Add(viewModel); CurrentViewModel = viewModel; RaisePropertyChanged(() => CurrentViewModel); viewModel.ChildViewModelChanged += vm => AddViewModel(vm); return(this); }
public IDetailedStatisticsAnalyzerViewModel InitializeWith(IActionSequenceStatisticsSet actionSequenceStatisticsSet) { ViewModelHistory.Clear(); Predicate <IActionSequenceStatisticsSet> isPreflop = s => s.Street == Streets.PreFlop; Predicate <IActionSequenceStatisticsSet> isHeroActs = s => s.ActionSequence == ActionSequences.HeroActs; Predicate <IActionSequenceStatisticsSet> isOppB = s => s.ActionSequence == ActionSequences.OppB; Predicate <IActionSequenceStatisticsSet> isHeroXOppB = s => s.ActionSequence == ActionSequences.HeroXOppB; IDetailedStatisticsViewModel detailedStatisticsViewModel = null; actionSequenceStatisticsSet.Match() .With(isPreflop, _ => detailedStatisticsViewModel = _detailedPreFlopStatisticsViewModelMake.New) .With(isHeroActs, _ => detailedStatisticsViewModel = _detailedPostFlopActionStatisticsViewModelMake.New) .With(isOppB, _ => detailedStatisticsViewModel = _detailedPostFlopReactionStatisticsViewModelMake.New) .With(isHeroXOppB, _ => detailedStatisticsViewModel = _detailedPostFlopReactionStatisticsViewModelMake.New) .Do(); AddViewModel(detailedStatisticsViewModel); detailedStatisticsViewModel.InitializeWith(actionSequenceStatisticsSet); return(this); }