using Common.Library; using GreadyPoang.DataLayer; using GreadyPoang.EntityLayer; using GreadyPoang.Services; using System.Collections.ObjectModel; using System.Diagnostics; namespace GreadyPoang.ViewModelLayer; public class RoundRunningViewModel : ViewModelBase { public RoundRunningViewModel() : base() { } public RoundRunningViewModel( IRepository roundsRepo, IRepository pointsRepo, IMethodSharingService sharingService, ICombinedRepository combined, IObjectMessageService objectMessage ) : base() { _roundsRepo = roundsRepo; _pointsRepo = pointsRepo; _sharingService = sharingService; _combined = combined; _objectMessage = objectMessage; _roundElements = new ObservableCollection(); } private readonly IRepository? _roundsRepo; private readonly IRepository _pointsRepo; private readonly IMethodSharingService _sharingService; private readonly ICombinedRepository _combined; private readonly IObjectMessageService _objectMessage; private ObservableCollection _roundElements; private ObservableCollection _GameRoundList = new(); private ObservableCollection _ParticipantList = new(); public ObservableCollection RoundElements { get { return _roundElements; } set { _roundElements = value; RaisePropertyChanged(nameof(RoundElements)); } } public ObservableCollection Get() { if (_objectMessage.CurrentGroup != null) { Debug.WriteLine($"Chosen round: {_objectMessage.CurrentGroup.GameRoundId}"); if (RoundElements.Count > 0) { RoundElements.Clear(); } foreach (var item in _objectMessage.CurrentGroup.Elements) { _roundElements.Add(item); } } return RoundElements; } }