diff --git a/Common.Library/Common.Library.csproj b/Common.Library/Common.Library.csproj
index 069991c..872f283 100644
--- a/Common.Library/Common.Library.csproj
+++ b/Common.Library/Common.Library.csproj
@@ -6,5 +6,19 @@
enable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GreadyPoang.Common/GreadyPoang.Common.csproj b/GreadyPoang.Common/GreadyPoang.Common.csproj
index 552d4ed..ae1d8e8 100644
--- a/GreadyPoang.Common/GreadyPoang.Common.csproj
+++ b/GreadyPoang.Common/GreadyPoang.Common.csproj
@@ -7,6 +7,7 @@
+
diff --git a/GreadyPoang.DataLayer/GreadyPoang.DataLayer.csproj b/GreadyPoang.DataLayer/GreadyPoang.DataLayer.csproj
index 1dbefd6..d508f18 100644
--- a/GreadyPoang.DataLayer/GreadyPoang.DataLayer.csproj
+++ b/GreadyPoang.DataLayer/GreadyPoang.DataLayer.csproj
@@ -11,6 +11,7 @@
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/GreadyPoang.EntityLayer/EntityClasses/GamePoint.cs b/GreadyPoang.EntityLayer/EntityClasses/GamePoint.cs
index 1bd6b85..981f01e 100644
--- a/GreadyPoang.EntityLayer/EntityClasses/GamePoint.cs
+++ b/GreadyPoang.EntityLayer/EntityClasses/GamePoint.cs
@@ -1,9 +1,9 @@
-using Common.Library;
+using CommunityToolkit.Mvvm.ComponentModel;
using SQLite;
namespace GreadyPoang.EntityLayer;
[Table("GamePoint")]
-public class GamePoint : EntityBase
+public class GamePoint : ObservableObject
{
public GamePoint()
{
@@ -31,7 +31,7 @@ public class GamePoint : EntityBase
set
{
_gamePointId = value;
- RaisePropertyChanged(nameof(GamePointId));
+ OnPropertyChanged(nameof(GamePointId));
}
}
@@ -42,7 +42,7 @@ public class GamePoint : EntityBase
set
{
_participantId = value;
- RaisePropertyChanged(nameof(ParticipantId));
+ OnPropertyChanged(nameof(ParticipantId));
}
}
[Column("GameRoundId")]
@@ -52,7 +52,7 @@ public class GamePoint : EntityBase
set
{
_gameRoundId = value;
- RaisePropertyChanged(nameof(GameRoundId));
+ OnPropertyChanged(nameof(GameRoundId));
}
}
@@ -63,7 +63,7 @@ public class GamePoint : EntityBase
set
{
_gameDate = value;
- RaisePropertyChanged(nameof(GameDate));
+ OnPropertyChanged(nameof(GameDate));
}
}
@@ -77,7 +77,7 @@ public class GamePoint : EntityBase
set
{
_gameRoundRegNr = value;
- RaisePropertyChanged(nameof(GameRoundRegNr));
+ OnPropertyChanged(nameof(GameRoundRegNr));
}
}
@@ -88,7 +88,7 @@ public class GamePoint : EntityBase
set
{
_gameRegPoints = value;
- RaisePropertyChanged(nameof(GameRegPoints));
+ OnPropertyChanged(nameof(GameRegPoints));
}
}
diff --git a/GreadyPoang.EntityLayer/EntityClasses/GameRound.cs b/GreadyPoang.EntityLayer/EntityClasses/GameRound.cs
index f1e638e..2c2853d 100644
--- a/GreadyPoang.EntityLayer/EntityClasses/GameRound.cs
+++ b/GreadyPoang.EntityLayer/EntityClasses/GameRound.cs
@@ -1,4 +1,4 @@
-using Common.Library;
+using CommunityToolkit.Mvvm.ComponentModel;
using SQLite;
namespace GreadyPoang.EntityLayer;
@@ -6,7 +6,7 @@ namespace GreadyPoang.EntityLayer;
[Table("GameRound")]
-public class GameRound : EntityBase
+public class GameRound : ObservableObject
{
public GameRound()
{
@@ -28,7 +28,7 @@ public class GameRound : EntityBase
set
{
_gameRoundFinished = value;
- RaisePropertyChanged(nameof(GameRoundFinished));
+ OnPropertyChanged(nameof(GameRoundFinished));
}
}
@@ -39,7 +39,7 @@ public class GameRound : EntityBase
set
{
_gameRoundStartDate = value;
- RaisePropertyChanged(nameof(GameRoundStartDate));
+ OnPropertyChanged(nameof(GameRoundStartDate));
}
}
@@ -50,7 +50,7 @@ public class GameRound : EntityBase
set
{
_gameStatus = value;
- RaisePropertyChanged(nameof(GameStatus));
+ OnPropertyChanged(nameof(GameStatus));
}
}
@@ -64,7 +64,7 @@ public class GameRound : EntityBase
set
{
_gameRoundId = value;
- RaisePropertyChanged(nameof(GameRoundId));
+ OnPropertyChanged(nameof(GameRoundId));
}
}
diff --git a/GreadyPoang.EntityLayer/EntityClasses/Participant.cs b/GreadyPoang.EntityLayer/EntityClasses/Participant.cs
index b18b9bd..e70a222 100644
--- a/GreadyPoang.EntityLayer/EntityClasses/Participant.cs
+++ b/GreadyPoang.EntityLayer/EntityClasses/Participant.cs
@@ -1,9 +1,9 @@
-using Common.Library;
+using CommunityToolkit.Mvvm.ComponentModel;
using SQLite;
namespace GreadyPoang.EntityLayer;
[Table("Participants")]
-public class Participant : EntityBase
+public class Participant : ObservableObject
{
public Participant()
{
@@ -26,7 +26,7 @@ public class Participant : EntityBase
set
{
_participantId = value;
- RaisePropertyChanged(nameof(ParticipantId));
+ OnPropertyChanged(nameof(ParticipantId));
}
}
@@ -37,7 +37,7 @@ public class Participant : EntityBase
set
{
_firstName = value;
- RaisePropertyChanged(nameof(FirstName));
+ OnPropertyChanged(nameof(FirstName));
}
}
@@ -48,7 +48,7 @@ public class Participant : EntityBase
set
{
_lastName = value;
- RaisePropertyChanged(nameof(LastName));
+ OnPropertyChanged(nameof(LastName));
}
}
@@ -59,7 +59,7 @@ public class Participant : EntityBase
set
{
_email = value;
- RaisePropertyChanged(nameof(Email));
+ OnPropertyChanged(nameof(Email));
}
}
diff --git a/GreadyPoang.EntityLayer/GreadyPoang.EntityLayer.csproj b/GreadyPoang.EntityLayer/GreadyPoang.EntityLayer.csproj
index 167f71d..048edd9 100644
--- a/GreadyPoang.EntityLayer/GreadyPoang.EntityLayer.csproj
+++ b/GreadyPoang.EntityLayer/GreadyPoang.EntityLayer.csproj
@@ -11,6 +11,7 @@
+
diff --git a/GreadyPoang.EntityLayer/HelperEntities/PlayerColumn.cs b/GreadyPoang.EntityLayer/HelperEntities/PlayerColumn.cs
index 41cae42..52a53d5 100644
--- a/GreadyPoang.EntityLayer/HelperEntities/PlayerColumn.cs
+++ b/GreadyPoang.EntityLayer/HelperEntities/PlayerColumn.cs
@@ -1,8 +1,8 @@
-using Common.Library;
+using CommunityToolkit.Mvvm.ComponentModel;
namespace GreadyPoang.EntityLayer;
-public class PlayerColumn : EntityBase
+public class PlayerColumn : ObservableObject
{
public PlayerColumn()
{
@@ -20,7 +20,7 @@ public class PlayerColumn : EntityBase
set
{
_playerName = value;
- RaisePropertyChanged(nameof(PlayerName));
+ OnPropertyChanged(nameof(PlayerName));
}
}
public List Values
@@ -29,7 +29,7 @@ public class PlayerColumn : EntityBase
set
{
_values = value;
- RaisePropertyChanged(nameof(Values));
+ OnPropertyChanged(nameof(Values));
}
}
@@ -39,7 +39,7 @@ public class PlayerColumn : EntityBase
set
{
_playerId = value;
- RaisePropertyChanged(nameof(PlayerId));
+ OnPropertyChanged(nameof(PlayerId));
}
}
diff --git a/GreadyPoang.EntityLayer/HelperEntities/RoundBuilderElement.cs b/GreadyPoang.EntityLayer/HelperEntities/RoundBuilderElement.cs
index 1b6c854..fccf7f0 100644
--- a/GreadyPoang.EntityLayer/HelperEntities/RoundBuilderElement.cs
+++ b/GreadyPoang.EntityLayer/HelperEntities/RoundBuilderElement.cs
@@ -1,8 +1,8 @@
-using Common.Library;
+using CommunityToolkit.Mvvm.ComponentModel;
namespace GreadyPoang.EntityLayer;
-public class RoundBuilderElement : EntityBase
+public class RoundBuilderElement : ObservableObject
{
public RoundBuilderElement()
{
@@ -31,7 +31,7 @@ public class RoundBuilderElement : EntityBase
set
{
_participantId = value;
- RaisePropertyChanged(nameof(ParticipantId));
+ OnPropertyChanged(nameof(ParticipantId));
}
}
@@ -42,7 +42,7 @@ public class RoundBuilderElement : EntityBase
set
{
_participantName = value;
- RaisePropertyChanged(nameof(ParticipantName));
+ OnPropertyChanged(nameof(ParticipantName));
}
}
@@ -53,7 +53,7 @@ public class RoundBuilderElement : EntityBase
set
{
_gameRoundRegNr = value;
- RaisePropertyChanged(nameof(GameRoundRegNr));
+ OnPropertyChanged(nameof(GameRoundRegNr));
}
}
@@ -64,7 +64,7 @@ public class RoundBuilderElement : EntityBase
set
{
_gameRegPoints = value;
- RaisePropertyChanged(nameof(GameRegPoints));
+ OnPropertyChanged(nameof(GameRegPoints));
}
}
@@ -75,8 +75,8 @@ public class RoundBuilderElement : EntityBase
set
{
_status = value;
- RaisePropertyChanged(nameof(Status));
- RaisePropertyChanged(nameof(StatusString));
+ OnPropertyChanged(nameof(Status));
+ OnPropertyChanged(nameof(StatusString));
}
}
@@ -91,8 +91,8 @@ public class RoundBuilderElement : EntityBase
set
{
_gameRoundStartDate = value;
- RaisePropertyChanged(nameof(GameRoundStartDate));
- RaisePropertyChanged(nameof(GameRoundStartDateString));
+ OnPropertyChanged(nameof(GameRoundStartDate));
+ OnPropertyChanged(nameof(GameRoundStartDateString));
}
}
@@ -107,7 +107,7 @@ public class RoundBuilderElement : EntityBase
set
{
_gameRoundId = value;
- RaisePropertyChanged(nameof(GameRoundId));
+ OnPropertyChanged(nameof(GameRoundId));
}
}
@@ -118,7 +118,7 @@ public class RoundBuilderElement : EntityBase
set
{
_gamePointId = value;
- RaisePropertyChanged(nameof(GamePointId));
+ OnPropertyChanged(nameof(GamePointId));
}
}
diff --git a/GreadyPoang.EntityLayer/HelperEntities/RoundBuilderGroup.cs b/GreadyPoang.EntityLayer/HelperEntities/RoundBuilderGroup.cs
index 7e01867..e12a358 100644
--- a/GreadyPoang.EntityLayer/HelperEntities/RoundBuilderGroup.cs
+++ b/GreadyPoang.EntityLayer/HelperEntities/RoundBuilderGroup.cs
@@ -1,20 +1,21 @@
-using Common.Library;
+using CommunityToolkit.Mvvm.ComponentModel;
namespace GreadyPoang.EntityLayer;
-public class RoundBuilderGroup : EntityBase
+public partial class RoundBuilderGroup : ObservableObject
{
public RoundBuilderGroup()
{
_gameRoundId = 0;
_gameRoundStartDate = DateTime.MinValue;
_status = GamePointStatus.New;
- _elements = new List();
+ Elements = new List();
}
private int _gameRoundId;
private DateTime _gameRoundStartDate;
private GamePointStatus _status;
- private List _elements;
+ [ObservableProperty]
+ private List elements;
public int GameRoundId
{
get { return _gameRoundId; }
@@ -43,14 +44,14 @@ public class RoundBuilderGroup : EntityBase
}
}
- public List Elements
- {
- get { return _elements; }
- set
- {
- _elements = value;
- RaisePropertyChanged(nameof(Elements));
- // No need to raise property changed for this example
- }
- }
+ //public List Elements
+ //{
+ // get { return _elements; }
+ // set
+ // {
+ // _elements = value;
+ // OnPropertyChanged(nameof(Elements));
+ // // No need to raise property changed for this example
+ // }
+ //}
}
diff --git a/GreadyPoang.Migrations/GreadyPoang.Migrations.csproj b/GreadyPoang.Migrations/GreadyPoang.Migrations.csproj
index d608574..0f87aa4 100644
--- a/GreadyPoang.Migrations/GreadyPoang.Migrations.csproj
+++ b/GreadyPoang.Migrations/GreadyPoang.Migrations.csproj
@@ -8,6 +8,7 @@
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/GreadyPoang.Services/GreadyPoang.Services.csproj b/GreadyPoang.Services/GreadyPoang.Services.csproj
index 56ac9b4..dd28833 100644
--- a/GreadyPoang.Services/GreadyPoang.Services.csproj
+++ b/GreadyPoang.Services/GreadyPoang.Services.csproj
@@ -6,6 +6,10 @@
enable
+
+
+
+
diff --git a/GreadyPoang.ViewModelLayer/GreadyPoang.ViewModelLayer.csproj b/GreadyPoang.ViewModelLayer/GreadyPoang.ViewModelLayer.csproj
index 4a57926..16f5c2c 100644
--- a/GreadyPoang.ViewModelLayer/GreadyPoang.ViewModelLayer.csproj
+++ b/GreadyPoang.ViewModelLayer/GreadyPoang.ViewModelLayer.csproj
@@ -6,6 +6,10 @@
enable
+
+
+
+
diff --git a/GreadyPoang.ViewModelLayer/ViewModelClasses/MethodSharingService.cs b/GreadyPoang.ViewModelLayer/ViewModelClasses/MethodSharingService.cs
index 46a95c2..a4aebd3 100644
--- a/GreadyPoang.ViewModelLayer/ViewModelClasses/MethodSharingService.cs
+++ b/GreadyPoang.ViewModelLayer/ViewModelClasses/MethodSharingService.cs
@@ -1,10 +1,11 @@
using Common.Library;
+using CommunityToolkit.Mvvm.ComponentModel;
using GreadyPoang.EntityLayer;
using System.Collections.ObjectModel;
namespace GreadyPoang.ViewModelLayer;
-public class MethodSharingService : ViewModelBase, IMethodSharingService
+public class MethodSharingService : ObservableObject, IMethodSharingService
{
private readonly IRepository _repository;
diff --git a/GreadyPoang.ViewModelLayer/ViewModelClasses/ParticipantViewModel.cs b/GreadyPoang.ViewModelLayer/ViewModelClasses/ParticipantViewModel.cs
index 39f80d1..0de91f5 100644
--- a/GreadyPoang.ViewModelLayer/ViewModelClasses/ParticipantViewModel.cs
+++ b/GreadyPoang.ViewModelLayer/ViewModelClasses/ParticipantViewModel.cs
@@ -1,11 +1,12 @@
using Common.Library;
+using CommunityToolkit.Mvvm.ComponentModel;
using GreadyPoang.EntityLayer;
using System.Collections.ObjectModel;
namespace GreadyPoang.ViewModelLayer;
-public class ParticipantViewModel : ViewModelBase
+public partial class ParticipantViewModel : ObservableObject
{
#region Constructors
public ParticipantViewModel() : base()
@@ -17,41 +18,21 @@ public class ParticipantViewModel : ViewModelBase
{
_Repository = repo;
_sharingService = sharingService;
+ ParticipantObject = new Participant();
+ ParticipantList = new ObservableCollection();
}
#endregion
#region Private Variables
- private Participant? _ParticipantObject = new();
- private ObservableCollection _ParticipantList = new();
+ [ObservableProperty]
+ private Participant? participantObject;
+ [ObservableProperty]
+ private ObservableCollection participantList;
private readonly IRepository? _Repository;
private readonly IMethodSharingService _sharingService;
#endregion
- #region public Properties
-
- public Participant? ParticipantObject
- {
- get { return _ParticipantObject; }
- set
- {
- _ParticipantObject = value;
- RaisePropertyChanged(nameof(ParticipantObject));
- }
- }
-
- public ObservableCollection ParticipantList
- {
- get { return _ParticipantList; }
- set
- {
- _ParticipantList = value;
- RaisePropertyChanged(nameof(ParticipantList));
- }
- }
-
- #endregion
-
#region Get Method
public ObservableCollection Get()
{
diff --git a/GreadyPoang.ViewModelLayer/ViewModelClasses/RoundRunningViewModel.cs b/GreadyPoang.ViewModelLayer/ViewModelClasses/RoundRunningViewModel.cs
index 35809e5..7dec962 100644
--- a/GreadyPoang.ViewModelLayer/ViewModelClasses/RoundRunningViewModel.cs
+++ b/GreadyPoang.ViewModelLayer/ViewModelClasses/RoundRunningViewModel.cs
@@ -1,4 +1,5 @@
using Common.Library;
+using CommunityToolkit.Mvvm.ComponentModel;
using GreadyPoang.DataLayer;
using GreadyPoang.EntityLayer;
using GreadyPoang.Services;
@@ -7,7 +8,7 @@ using System.Diagnostics;
namespace GreadyPoang.ViewModelLayer;
-public class RoundRunningViewModel : ViewModelBase
+public partial class RoundRunningViewModel : ObservableObject
{
public event EventHandler RebuildRequested;
@@ -30,8 +31,8 @@ public class RoundRunningViewModel : ViewModelBase
_sharingService = sharingService;
_combined = combined;
_objectMessage = objectMessage;
- _roundElements = new ObservableCollection();
- _builderObject = new();
+ RoundElements = new ObservableCollection();
+ BuilderObject = new();
}
private readonly IRepository? _roundsRepo;
@@ -40,11 +41,15 @@ public class RoundRunningViewModel : ViewModelBase
private readonly ICombinedRepository _combined;
private readonly IObjectMessageService _objectMessage;
- private ObservableCollection _GameRoundList = new();
- private ObservableCollection _ParticipantList = new();
- private ObservableCollection _roundElements;
- private Collection _playerColumns;
- private RoundBuilderElement _builderObject;
+ //private ObservableCollection _GameRoundList = new();
+ //private ObservableCollection _ParticipantList = new();
+
+ [ObservableProperty]
+ private ObservableCollection roundElements;
+ [ObservableProperty]
+ private Collection playerColumns;
+ [ObservableProperty]
+ private RoundBuilderElement builderObject;
public void TriggerRebuild()
{
@@ -52,35 +57,35 @@ public class RoundRunningViewModel : ViewModelBase
RebuildRequested?.Invoke(this, EventArgs.Empty);
}
- public ObservableCollection RoundElements
- {
- get { return _roundElements; }
- set
- {
- _roundElements = value;
- RaisePropertyChanged(nameof(RoundElements));
- }
- }
+ //public ObservableCollection RoundElements
+ //{
+ // get { return _roundElements; }
+ // set
+ // {
+ // _roundElements = value;
+ // OnPropertyChanged(nameof(RoundElements));
+ // }
+ //}
- public Collection PlayerColumns
- {
- get { return _playerColumns; }
- set
- {
- _playerColumns = value;
- RaisePropertyChanged(nameof(PlayerColumns));
- }
- }
+ //public Collection PlayerColumns
+ //{
+ // get { return _playerColumns; }
+ // set
+ // {
+ // _playerColumns = value;
+ // OnPropertyChanged(nameof(PlayerColumns));
+ // }
+ //}
- public RoundBuilderElement BuilderObject
- {
- get { return _builderObject; }
- set
- {
- _builderObject = value;
- RaisePropertyChanged(nameof(BuilderObject));
- }
- }
+ //public RoundBuilderElement BuilderObject
+ //{
+ // get { return _builderObject; }
+ // set
+ // {
+ // _builderObject = value;
+ // OnPropertyChanged(nameof(BuilderObject));
+ // }
+ //}
public ObservableCollection Get()
@@ -97,7 +102,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
@@ -113,7 +118,7 @@ public class RoundRunningViewModel : ViewModelBase
var localElements = _combined.roundBuilderElementsTotalById(_objectMessage.CurrentGroup.GameRoundId);
FillupResultTable(localElements);
- foreach (var col in _playerColumns)
+ foreach (var col in PlayerColumns)
{
RoundElements.FirstOrDefault(e => e.ParticipantId == col.PlayerId).GameRegPoints = col.PlayerPoints;
}
@@ -166,7 +171,7 @@ public class RoundRunningViewModel : ViewModelBase
var localElements = _combined.roundBuilderElementsTotalById(BuilderObject.GameRoundId);
FillupResultTable(localElements);
- foreach (var col in _playerColumns)
+ foreach (var col in PlayerColumns)
{
RoundElements.FirstOrDefault(e => e.ParticipantId == col.PlayerId).GameRegPoints = col.PlayerPoints;
}
@@ -189,13 +194,13 @@ public class RoundRunningViewModel : ViewModelBase
private void FillupResultTable(IEnumerable elements)
{
- if (_playerColumns != null)
+ if (PlayerColumns != null)
{
- _playerColumns.Clear();
+ PlayerColumns.Clear();
}
else
{
- _playerColumns = new Collection();
+ PlayerColumns = new Collection();
}
// if (elements.Any(g => g.GameRegPoints > 0))
@@ -205,7 +210,7 @@ public class RoundRunningViewModel : ViewModelBase
foreach (var element in elements)
{
- player = _playerColumns.FirstOrDefault(p => p.PlayerId == element.ParticipantId);
+ player = PlayerColumns.FirstOrDefault(p => p.PlayerId == element.ParticipantId);
if (player == null)
{
@@ -224,9 +229,9 @@ public class RoundRunningViewModel : ViewModelBase
}
//oldPart = element.ParticipantId;
- if (!_playerColumns.Contains(player))
+ if (!PlayerColumns.Contains(player))
{
- _playerColumns.Add(player);
+ PlayerColumns.Add(player);
}
}
}
@@ -238,7 +243,9 @@ public class RoundRunningViewModel : ViewModelBase
{
var player = new PlayerColumn
{
- PlayerName = element.ParticipantName
+ PlayerName = element.ParticipantName,
+ PlayerId = element.ParticipantId,
+ PlayerPoints = 0
};
for (int i = 0; i < slumper.Next(6); i++)
@@ -246,7 +253,7 @@ public class RoundRunningViewModel : ViewModelBase
player.Values.Add(slumper.Next(1, 10).ToString());
}
- _playerColumns.Add(player);
+ PlayerColumns.Add(player);
}
}
}
diff --git a/GreadyPoang.ViewModelLayer/ViewModelClasses/RoundStartingViewModel.cs b/GreadyPoang.ViewModelLayer/ViewModelClasses/RoundStartingViewModel.cs
index aafa65c..6b7d7d2 100644
--- a/GreadyPoang.ViewModelLayer/ViewModelClasses/RoundStartingViewModel.cs
+++ b/GreadyPoang.ViewModelLayer/ViewModelClasses/RoundStartingViewModel.cs
@@ -1,4 +1,5 @@
using Common.Library;
+using CommunityToolkit.Mvvm.ComponentModel;
using GreadyPoang.DataLayer;
using GreadyPoang.EntityLayer;
using GreadyPoang.Services;
@@ -7,7 +8,7 @@ using System.Diagnostics;
namespace GreadyPoang.ViewModelLayer;
-public class RoundStartingViewModel : ViewModelBase
+public partial class RoundStartingViewModel : ObservableObject
{
#region Constructors
public RoundStartingViewModel() : base()
@@ -27,52 +28,100 @@ public class RoundStartingViewModel : ViewModelBase
_sharingService = sharingService;
_combined = combined;
_objectMessage = objectMessage;
- _roundElements = new ObservableCollection();
+ RoundElements = new ObservableCollection();
}
#endregion
- private GameRound? _GameRoundObject = new();
- private ObservableCollection _GameRoundList = new();
- private ObservableCollection _ParticipantList = new();
private readonly IRepository? _roundsRepo;
private readonly IRepository _pointsRepo;
private readonly IMethodSharingService _sharingService;
private readonly ICombinedRepository _combined;
private readonly IObjectMessageService _objectMessage;
- private Participant _selectedItem;
- private ObservableCollection _roundElements;
-
- public ObservableCollection RoundElements
+ [ObservableProperty]
+ private Participant selectedItem;
+ partial void OnSelectedItemChanged(Participant value)
{
- get { return _roundElements; }
- set
+ if (value != null)
{
- _roundElements = value;
- RaisePropertyChanged(nameof(RoundElements));
+ OnItemSelected(value);
}
}
+ [ObservableProperty]
+ private ObservableCollection roundElements;
- public Participant SelectedItem
- {
- get => _selectedItem;
- set
- {
- if (_selectedItem != value)
- {
+ [ObservableProperty]
+ private GameRound? gameRoundObject = new();
- _selectedItem = value;
- RaisePropertyChanged(nameof(SelectedItem));
- OnItemSelected(value); // Metod som triggas vid val
- }
- }
- }
+ [ObservableProperty]
+ private ObservableCollection gameRoundList = new();
+ [ObservableProperty]
+ private ObservableCollection participantList = new();
+
+
+ #region commented out
+
+ //public ObservableCollection RoundElements
+ //{
+ // get { return _roundElements; }
+ // set
+ // {
+ // _roundElements = value;
+ // OnPropertyChanged(nameof(RoundElements));
+ // }
+ //}
+
+
+ //public Participant SelectedItem
+ //{
+ // get => _selectedItem;
+ // set
+ // {
+ // if (_selectedItem != value)
+ // {
+
+ // _selectedItem = value;
+ // OnPropertyChanged(nameof(SelectedItem));
+ // OnItemSelected(value); // Metod som triggas vid val
+ // }
+ // }
+ //}
+
+ //public GameRound? GameRoundObject
+ //{
+ // get { return _GameRoundObject; }
+ // set
+ // {
+ // _GameRoundObject = value;
+ // OnPropertyChanged(nameof(GameRoundObject));
+ // }
+ //}
+
+ //public ObservableCollection GameRoundList
+ //{
+ // get { return _GameRoundList; }
+ // set
+ // {
+ // _GameRoundList = value;
+ // OnPropertyChanged(nameof(GameRoundList));
+ // }
+ //}
+ //public ObservableCollection ParticipantList
+ //{
+ // get { return _ParticipantList; }
+ // set
+ // {
+ // _ParticipantList = value;
+ // OnPropertyChanged(nameof(ParticipantList));
+ // }
+ //}
+ #endregion
private void OnItemSelected(Participant item)
{
- if (_roundElements.Count == 0)
+ if (RoundElements.Count == 0)
{
var GameRound = new GameRound
{
@@ -110,42 +159,12 @@ public class RoundStartingViewModel : ViewModelBase
newElement.GameRoundId = GamePointStart.GameRoundId;
newElement.GamePointId = GamePointStart.GamePointId;
- _roundElements.Add(newElement);
+ RoundElements.Add(newElement);
// Gör något med det valda objektet
Debug.WriteLine($"Du valde: {item.LastNameFirstName}");
}
- public GameRound? GameRoundObject
- {
- get { return _GameRoundObject; }
- set
- {
- _GameRoundObject = value;
- RaisePropertyChanged(nameof(GameRoundObject));
- }
- }
-
- public ObservableCollection GameRoundList
- {
- get { return _GameRoundList; }
- set
- {
- _GameRoundList = value;
- RaisePropertyChanged(nameof(GameRoundList));
- }
- }
-
- public ObservableCollection ParticipantList
- {
- get { return _ParticipantList; }
- set
- {
- _ParticipantList = value;
- RaisePropertyChanged(nameof(ParticipantList));
- }
- }
-
#region Get Method
public ObservableCollection Get()
{
diff --git a/GreadyPoang/CommandClasses/ParticipantViewModelCommands.cs b/GreadyPoang/CommandClasses/ParticipantViewModelCommands.cs
index 57d1806..7925764 100644
--- a/GreadyPoang/CommandClasses/ParticipantViewModelCommands.cs
+++ b/GreadyPoang/CommandClasses/ParticipantViewModelCommands.cs
@@ -1,11 +1,12 @@
using Common.Library;
+using CommunityToolkit.Mvvm.ComponentModel;
using GreadyPoang.EntityLayer;
using GreadyPoang.ViewModelLayer;
using System.Windows.Input;
namespace GreadyPoang.CommandClasses;
-public class ParticipantViewModelCommands : ParticipantViewModel
+public partial class ParticipantViewModelCommands : ParticipantViewModel
{
#region constructors
public ParticipantViewModelCommands() : base()
@@ -14,24 +15,15 @@ public class ParticipantViewModelCommands : ParticipantViewModel
}
public ParticipantViewModelCommands(IRepository repo, IMethodSharingService sharingService) : base(repo, sharingService)
{
+ Init();
+ IsSaveCommandEnabled = true;
}
#endregion
#region Private Variables
- private bool _IsSaveCommandEnabled = true;
- #endregion
-
- #region Public Properties
- public bool IsSaveCommandEnabled
- {
- get { return _IsSaveCommandEnabled; }
- set
- {
- _IsSaveCommandEnabled = value;
- RaisePropertyChanged(nameof(IsSaveCommandEnabled));
- }
- }
+ [ObservableProperty]
+ private bool isSaveCommandEnabled;
#endregion
#region Commands
@@ -40,9 +32,9 @@ public class ParticipantViewModelCommands : ParticipantViewModel
#endregion
#region Init Method
- public override void Init()
+ public void Init()
{
- base.Init();
+ //base.Init();
SaveCommand = new Command(async () => SaveAsync(), () => IsSaveCommandEnabled);
EditCommand = new Command(async (id) => await EditAsync(id), (id) => id > 0);
}
diff --git a/GreadyPoang/CommandClasses/RoundRunningViewModelCommands.cs b/GreadyPoang/CommandClasses/RoundRunningViewModelCommands.cs
index c4407c8..d0aa544 100644
--- a/GreadyPoang/CommandClasses/RoundRunningViewModelCommands.cs
+++ b/GreadyPoang/CommandClasses/RoundRunningViewModelCommands.cs
@@ -25,27 +25,22 @@ public class RoundRunningViewModelCommands : RoundRunningViewModel
combined,
objectMessage)
{
+ Init();
}
#region Commands
- public ICommand SaveCommand { get; private set; }
- public ICommand EditCommand { get; private set; }
- public ICommand RensaCommand { get; private set; }
- public ICommand ElementTappedCommand { get; private set; }
- public ICommand ParticipantTappedCommand { get; private set; }
+ //public ICommand SaveCommand { get; private set; }
+ //public ICommand EditCommand { get; private set; }
+ //public ICommand RensaCommand { get; private set; }
+ //public ICommand ElementTappedCommand { get; private set; }
+ //public ICommand ParticipantTappedCommand { get; private set; }
public ICommand StoreAndHandlePointsCommand { get; private set; }
#endregion
- public override void Init()
+ public void Init()
{
- base.Init();
StoreAndHandlePointsCommand = new Command(async () => StoreAndHandleAsync());
- //EditCommand = new Command(async (id) => await EditAsync(id), (id) => id > 0);
- //RensaCommand = new Command(async () => RensaAsync());
- //ParticipantTappedCommand = new Command(async (selectedParticipant) => SelectNewlyAddedParticipant(selectedParticipant));
- //ElementTappedCommand = new Command((selectedElement) => RoundSelected(selectedElement));
-
}
private async Task StoreAndHandleAsync()
diff --git a/GreadyPoang/CommandClasses/RoundStartingViewModelCommands.cs b/GreadyPoang/CommandClasses/RoundStartingViewModelCommands.cs
index d4a845b..a9b3176 100644
--- a/GreadyPoang/CommandClasses/RoundStartingViewModelCommands.cs
+++ b/GreadyPoang/CommandClasses/RoundStartingViewModelCommands.cs
@@ -1,4 +1,5 @@
using Common.Library;
+using CommunityToolkit.Mvvm.ComponentModel;
using GreadyPoang.DataLayer;
using GreadyPoang.EntityLayer;
using GreadyPoang.Services;
@@ -7,7 +8,7 @@ using System.Windows.Input;
namespace GreadyPoang.CommandClasses;
-public class RoundStartingViewModelCommands : RoundStartingViewModel
+public partial class RoundStartingViewModelCommands : RoundStartingViewModel
{
public RoundStartingViewModelCommands() : base()
{
@@ -25,23 +26,13 @@ public class RoundStartingViewModelCommands : RoundStartingViewModel
combined,
objectMessage)
{
+ Init();
+ IsSaveCommandEnabled = true;
}
#region Private Variables
- private bool _IsSaveCommandEnabled = true;
- #endregion
-
- #region Public Properties
- public bool IsSaveCommandEnabled
- {
- get { return _IsSaveCommandEnabled; }
- set
- {
- _IsSaveCommandEnabled = value;
- RaisePropertyChanged(nameof(IsSaveCommandEnabled));
- }
- }
-
+ [ObservableProperty]
+ private bool isSaveCommandEnabled;
#endregion
#region Commands
@@ -53,9 +44,10 @@ public class RoundStartingViewModelCommands : RoundStartingViewModel
#endregion
#region Init Method
- public override void Init()
+
+ public void Init()
{
- base.Init();
+ //base.Init();
SaveCommand = new Command(async () => SaveAsync(), () => IsSaveCommandEnabled);
EditCommand = new Command(async (id) => await EditAsync(id), (id) => id > 0);
RensaCommand = new Command(async () => RensaAsync());
diff --git a/GreadyPoang/GreadyPoang.csproj b/GreadyPoang/GreadyPoang.csproj
index a7fa4ac..6fc9ac5 100644
--- a/GreadyPoang/GreadyPoang.csproj
+++ b/GreadyPoang/GreadyPoang.csproj
@@ -60,6 +60,7 @@
+