Poängräkning fungerar i RoundRunning
This commit is contained in:
@ -0,0 +1,30 @@
|
||||
using Common.Library;
|
||||
using GreadyPoang.Services;
|
||||
|
||||
namespace GreadyPoang.ViewModelLayer;
|
||||
|
||||
public class MainPageViewModel : ViewModelBase
|
||||
{
|
||||
private readonly AppShellViewModel _appShell;
|
||||
private readonly IObjectMessageService _messageService;
|
||||
|
||||
public MainPageViewModel(
|
||||
AppShellViewModel appShell,
|
||||
IObjectMessageService messageService
|
||||
) : base()
|
||||
{
|
||||
|
||||
_appShell = appShell;
|
||||
_messageService = messageService;
|
||||
|
||||
}
|
||||
|
||||
public void InitMessage()
|
||||
{
|
||||
if (_appShell.RoundRunningVisible == false)
|
||||
{
|
||||
_messageService.Delivered = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
using Common.Library;
|
||||
using GreadyPoang.EntityLayer;
|
||||
using GreadyPoang.Services;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
|
||||
@ -13,10 +14,16 @@ public class ParticipantViewModel : ViewModelBase
|
||||
|
||||
}
|
||||
|
||||
public ParticipantViewModel(IRepository<Participant> repo, IMethodSharingService<Participant> sharingService) : base()
|
||||
public ParticipantViewModel(
|
||||
IRepository<Participant> repo,
|
||||
IMethodSharingService<Participant> sharingService,
|
||||
AppShellViewModel appShell,
|
||||
IObjectMessageService objectMessage) : base()
|
||||
{
|
||||
_Repository = repo;
|
||||
_sharingService = sharingService;
|
||||
_appShell = appShell;
|
||||
_objectMessage = objectMessage;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -26,6 +33,8 @@ public class ParticipantViewModel : ViewModelBase
|
||||
private ObservableCollection<Participant> _ParticipantList = new();
|
||||
private readonly IRepository<Participant>? _Repository;
|
||||
private readonly IMethodSharingService<Participant> _sharingService;
|
||||
private readonly AppShellViewModel _appShell;
|
||||
private readonly IObjectMessageService _objectMessage;
|
||||
#endregion
|
||||
|
||||
#region public Properties
|
||||
@ -55,6 +64,10 @@ public class ParticipantViewModel : ViewModelBase
|
||||
#region Get Method
|
||||
public ObservableCollection<Participant> Get()
|
||||
{
|
||||
if (_appShell.RoundRunningVisible == false)
|
||||
{
|
||||
_objectMessage.Delivered = true;
|
||||
}
|
||||
ParticipantList = _sharingService.Get();
|
||||
return ParticipantList;
|
||||
}
|
||||
|
||||
@ -62,6 +62,7 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
RebuildRequested?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
// Översta raden
|
||||
public ObservableCollection<RoundBuilderElement> RoundElements
|
||||
{
|
||||
get { return _roundElements; }
|
||||
@ -72,6 +73,7 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
// Nedersta strukturen
|
||||
public Collection<PlayerColumn> PlayerColumns
|
||||
{
|
||||
get { return _playerColumns; }
|
||||
@ -122,7 +124,7 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
}
|
||||
foreach (var item in _objectMessage.CurrentGroup.Elements)
|
||||
{
|
||||
_roundElements.Add(item);
|
||||
RoundElements.Add(item);
|
||||
}
|
||||
|
||||
// Räkna ut vem som är nästa spelare
|
||||
@ -138,6 +140,10 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
var localElements = _combined.roundBuilderElementsTotalById(_objectMessage.CurrentGroup.GameRoundId);
|
||||
|
||||
FillupResultTable(localElements);
|
||||
foreach (var col in _playerColumns)
|
||||
{
|
||||
RoundElements.FirstOrDefault(e => e.ParticipantId == col.PlayerId).GameRegPoints = col.PlayerPoints;
|
||||
}
|
||||
TriggerRebuild();
|
||||
}
|
||||
return RoundElements;
|
||||
@ -206,8 +212,6 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void FillupResultTable(IEnumerable<RoundBuilderElement> elements)
|
||||
{
|
||||
if (_playerColumns != null)
|
||||
|
||||
Reference in New Issue
Block a user