public ReplayerView(FixedSizeList <ReplayerDataModel> dataModelList, IEnumerable <ReplayerDataModel> sessionHandsList, bool showHoleCards) { InitializeComponent(); if (dataModelList == null || dataModelList.Count() == 0 || !dataModelList.Any(x => x.IsActive)) { throw new ArgumentException("Data model list should contain at least one active value", "dataModelList"); } _lastHandsCollection = dataModelList; var dataModel = dataModelList.First(x => x.IsActive); Header = StringFormatter.GetReplayerHeaderString(dataModel.GameType, dataModel.Time); ViewModel.PropertyChanged += ViewModel_PropertyChanged; ViewModel.IsShowHoleCards = showHoleCards; ViewModel.ActivePlayerName = dataModel.Statistic.PlayerName; ViewModel.LastHandsCollection = new ObservableCollection <ReplayerDataModel>(dataModelList); ViewModel.SessionHandsCollection = new ObservableCollection <ReplayerDataModel>(sessionHandsList); ViewModel.CurrentHand = dataModel; ViewModel.ReplayerWindow = this; Loaded += ReplayerView_Loaded; }
private void UpdateCollections() { if (_lastHandsCollection != null) { if (!_lastHandsCollection.Any(x => x.Equals(ViewModel.CurrentHand))) { _lastHandsCollection.Add(ViewModel.CurrentHand); ViewModel.LastHandsCollection.Add(ViewModel.CurrentHand); } } if (ViewModel.SessionHandsCollection != null) { if (!ViewModel.SessionHandsCollection.Any(x => x.Equals(ViewModel.CurrentHand))) { SessionListBox.SelectedIndex = -1; } } }