Infört Observable Property och observable object från Community Toolkit
This commit is contained in:
@ -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