Infört Observable Property och observable object från Community Toolkit
This commit is contained in:
@ -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<Participant>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Variables
|
||||
private Participant? _ParticipantObject = new();
|
||||
private ObservableCollection<Participant> _ParticipantList = new();
|
||||
[ObservableProperty]
|
||||
private Participant? participantObject;
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<Participant> participantList;
|
||||
private readonly IRepository<Participant>? _Repository;
|
||||
private readonly IMethodSharingService<Participant> _sharingService;
|
||||
#endregion
|
||||
|
||||
#region public Properties
|
||||
|
||||
public Participant? ParticipantObject
|
||||
{
|
||||
get { return _ParticipantObject; }
|
||||
set
|
||||
{
|
||||
_ParticipantObject = value;
|
||||
RaisePropertyChanged(nameof(ParticipantObject));
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<Participant> ParticipantList
|
||||
{
|
||||
get { return _ParticipantList; }
|
||||
set
|
||||
{
|
||||
_ParticipantList = value;
|
||||
RaisePropertyChanged(nameof(ParticipantList));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Get Method
|
||||
public ObservableCollection<Participant> Get()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user