Infört Observable Property och observable object från Community Toolkit

This commit is contained in:
2025-10-13 08:59:26 +02:00
parent f5cc28f202
commit b2dbb9993f
21 changed files with 243 additions and 228 deletions

View File

@ -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
// }
//}
}