Spelrundebilden påbörjad , kommunikation mellan bilder fungerar

This commit is contained in:
2025-09-17 12:21:11 +02:00
parent a955218c7a
commit 12002b65dd
13 changed files with 134 additions and 33 deletions

View File

@ -10,6 +10,7 @@
<ProjectReference Include="..\Common.Library\Common.Library.csproj" />
<ProjectReference Include="..\GreadyPoang.DataLayer\GreadyPoang.DataLayer.csproj" />
<ProjectReference Include="..\GreadyPoang.EntityLayer\GreadyPoang.EntityLayer.csproj" />
<ProjectReference Include="..\GreadyPoang.Services\GreadyPoang.Services.csproj" />
</ItemGroup>
</Project>

View File

@ -1,7 +1,9 @@
using Common.Library;
using GreadyPoang.DataLayer;
using GreadyPoang.EntityLayer;
using GreadyPoang.Services;
using System.Collections.ObjectModel;
using System.Diagnostics;
namespace GreadyPoang.ViewModelLayer;
@ -17,23 +19,54 @@ public class RoundRunningViewModel : ViewModelBase
IRepository<GameRound> roundsRepo,
IRepository<GamePoint> pointsRepo,
IMethodSharingService<Participant> sharingService,
ICombinedRepository combined
ICombinedRepository combined,
IObjectMessageService objectMessage
) : base()
{
_roundsRepo = roundsRepo;
_pointsRepo = pointsRepo;
_sharingService = sharingService;
_combined = combined;
_objectMessage = objectMessage;
_roundElements = new ObservableCollection<RoundBuilderElement>();
}
private readonly IRepository<GameRound>? _roundsRepo;
private readonly IRepository<GamePoint> _pointsRepo;
private readonly IMethodSharingService<Participant> _sharingService;
private readonly ICombinedRepository _combined;
private readonly IObjectMessageService _objectMessage;
private ObservableCollection<RoundBuilderElement> _roundElements;
private ObservableCollection<RoundBuilderGroup> _GameRoundList = new();
private ObservableCollection<Participant> _ParticipantList = new();
private ObservableCollection<RoundBuilderElement> _roundElements;
public ObservableCollection<RoundBuilderElement> RoundElements
{
get { return _roundElements; }
set
{
_roundElements = value;
RaisePropertyChanged(nameof(RoundElements));
}
}
public ObservableCollection<RoundBuilderElement> 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;
}
}

View File

@ -1,6 +1,7 @@
using Common.Library;
using GreadyPoang.DataLayer;
using GreadyPoang.EntityLayer;
using GreadyPoang.Services;
using System.Collections.ObjectModel;
using System.Diagnostics;
@ -18,12 +19,14 @@ public class RoundStartingViewModel : ViewModelBase
IRepository<GameRound> roundsRepo,
IRepository<GamePoint> pointsRepo,
IMethodSharingService<Participant> sharingService,
ICombinedRepository combined) : base()
ICombinedRepository combined,
IObjectMessageService objectMessage) : base()
{
_roundsRepo = roundsRepo;
_pointsRepo = pointsRepo;
_sharingService = sharingService;
_combined = combined;
_objectMessage = objectMessage;
_roundElements = new ObservableCollection<RoundBuilderElement>();
}
@ -36,6 +39,7 @@ public class RoundStartingViewModel : ViewModelBase
private readonly IRepository<GamePoint> _pointsRepo;
private readonly IMethodSharingService<Participant> _sharingService;
private readonly ICombinedRepository _combined;
private readonly IObjectMessageService _objectMessage;
private Participant _selectedItem;
private ObservableCollection<RoundBuilderElement> _roundElements;
@ -228,7 +232,13 @@ public class RoundStartingViewModel : ViewModelBase
public void RoundSelected(RoundBuilderElement element)
{
var rbGroup = GameRoundList.FirstOrDefault(g => g.GameRoundId == element.GameRoundId);
Debug.WriteLine($"Du valde raden med Runda {element.GameRoundId} och spelare: {element.ParticipantName}");
if (rbGroup != null)
{
_objectMessage.CurrentGroup = rbGroup;
Shell.Current.GoToAsync("//RoundRunningView");
}
}
public void SelectNewlyAddedParticipant(RoundBuilderElement roundBuilder)