Infört Observable Property och observable object från Community Toolkit
This commit is contained in:
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
||||
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.11" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -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<string> 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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<RoundBuilderElement>();
|
||||
Elements = new List<RoundBuilderElement>();
|
||||
}
|
||||
private int _gameRoundId;
|
||||
private DateTime _gameRoundStartDate;
|
||||
private GamePointStatus _status;
|
||||
private List<RoundBuilderElement> _elements;
|
||||
[ObservableProperty]
|
||||
private List<RoundBuilderElement> elements;
|
||||
public int GameRoundId
|
||||
{
|
||||
get { return _gameRoundId; }
|
||||
@ -43,14 +44,14 @@ public class RoundBuilderGroup : EntityBase
|
||||
}
|
||||
}
|
||||
|
||||
public List<RoundBuilderElement> Elements
|
||||
{
|
||||
get { return _elements; }
|
||||
set
|
||||
{
|
||||
_elements = value;
|
||||
RaisePropertyChanged(nameof(Elements));
|
||||
// No need to raise property changed for this example
|
||||
}
|
||||
}
|
||||
//public List<RoundBuilderElement> Elements
|
||||
//{
|
||||
// get { return _elements; }
|
||||
// set
|
||||
// {
|
||||
// _elements = value;
|
||||
// OnPropertyChanged(nameof(Elements));
|
||||
// // No need to raise property changed for this example
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user