Infört Observable Property och observable object från Community Toolkit
This commit is contained in:
@ -6,5 +6,19 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="BaseClasses\CommonBase.cs" />
|
||||||
|
<Compile Remove="BaseClasses\EntityBase.cs" />
|
||||||
|
<Compile Remove="BaseClasses\ViewModelBase.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="BaseClasses\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.100" />
|
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.100" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.8">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.8">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
using Common.Library;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using SQLite;
|
using SQLite;
|
||||||
|
|
||||||
namespace GreadyPoang.EntityLayer;
|
namespace GreadyPoang.EntityLayer;
|
||||||
[Table("GamePoint")]
|
[Table("GamePoint")]
|
||||||
public class GamePoint : EntityBase
|
public class GamePoint : ObservableObject
|
||||||
{
|
{
|
||||||
public GamePoint()
|
public GamePoint()
|
||||||
{
|
{
|
||||||
@ -31,7 +31,7 @@ public class GamePoint : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_gamePointId = value;
|
_gamePointId = value;
|
||||||
RaisePropertyChanged(nameof(GamePointId));
|
OnPropertyChanged(nameof(GamePointId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ public class GamePoint : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_participantId = value;
|
_participantId = value;
|
||||||
RaisePropertyChanged(nameof(ParticipantId));
|
OnPropertyChanged(nameof(ParticipantId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[Column("GameRoundId")]
|
[Column("GameRoundId")]
|
||||||
@ -52,7 +52,7 @@ public class GamePoint : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_gameRoundId = value;
|
_gameRoundId = value;
|
||||||
RaisePropertyChanged(nameof(GameRoundId));
|
OnPropertyChanged(nameof(GameRoundId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ public class GamePoint : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_gameDate = value;
|
_gameDate = value;
|
||||||
RaisePropertyChanged(nameof(GameDate));
|
OnPropertyChanged(nameof(GameDate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ public class GamePoint : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_gameRoundRegNr = value;
|
_gameRoundRegNr = value;
|
||||||
RaisePropertyChanged(nameof(GameRoundRegNr));
|
OnPropertyChanged(nameof(GameRoundRegNr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ public class GamePoint : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_gameRegPoints = value;
|
_gameRegPoints = value;
|
||||||
RaisePropertyChanged(nameof(GameRegPoints));
|
OnPropertyChanged(nameof(GameRegPoints));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using Common.Library;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using SQLite;
|
using SQLite;
|
||||||
|
|
||||||
namespace GreadyPoang.EntityLayer;
|
namespace GreadyPoang.EntityLayer;
|
||||||
@ -6,7 +6,7 @@ namespace GreadyPoang.EntityLayer;
|
|||||||
|
|
||||||
[Table("GameRound")]
|
[Table("GameRound")]
|
||||||
|
|
||||||
public class GameRound : EntityBase
|
public class GameRound : ObservableObject
|
||||||
{
|
{
|
||||||
public GameRound()
|
public GameRound()
|
||||||
{
|
{
|
||||||
@ -28,7 +28,7 @@ public class GameRound : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_gameRoundFinished = value;
|
_gameRoundFinished = value;
|
||||||
RaisePropertyChanged(nameof(GameRoundFinished));
|
OnPropertyChanged(nameof(GameRoundFinished));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ public class GameRound : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_gameRoundStartDate = value;
|
_gameRoundStartDate = value;
|
||||||
RaisePropertyChanged(nameof(GameRoundStartDate));
|
OnPropertyChanged(nameof(GameRoundStartDate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public class GameRound : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_gameStatus = value;
|
_gameStatus = value;
|
||||||
RaisePropertyChanged(nameof(GameStatus));
|
OnPropertyChanged(nameof(GameStatus));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ public class GameRound : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_gameRoundId = value;
|
_gameRoundId = value;
|
||||||
RaisePropertyChanged(nameof(GameRoundId));
|
OnPropertyChanged(nameof(GameRoundId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
using Common.Library;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using SQLite;
|
using SQLite;
|
||||||
|
|
||||||
namespace GreadyPoang.EntityLayer;
|
namespace GreadyPoang.EntityLayer;
|
||||||
[Table("Participants")]
|
[Table("Participants")]
|
||||||
public class Participant : EntityBase
|
public class Participant : ObservableObject
|
||||||
{
|
{
|
||||||
public Participant()
|
public Participant()
|
||||||
{
|
{
|
||||||
@ -26,7 +26,7 @@ public class Participant : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_participantId = value;
|
_participantId = value;
|
||||||
RaisePropertyChanged(nameof(ParticipantId));
|
OnPropertyChanged(nameof(ParticipantId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public class Participant : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_firstName = value;
|
_firstName = value;
|
||||||
RaisePropertyChanged(nameof(FirstName));
|
OnPropertyChanged(nameof(FirstName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ public class Participant : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_lastName = value;
|
_lastName = value;
|
||||||
RaisePropertyChanged(nameof(LastName));
|
OnPropertyChanged(nameof(LastName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ public class Participant : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_email = value;
|
_email = value;
|
||||||
RaisePropertyChanged(nameof(Email));
|
OnPropertyChanged(nameof(Email));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
||||||
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.11" />
|
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.11" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
using Common.Library;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
namespace GreadyPoang.EntityLayer;
|
namespace GreadyPoang.EntityLayer;
|
||||||
|
|
||||||
public class PlayerColumn : EntityBase
|
public class PlayerColumn : ObservableObject
|
||||||
{
|
{
|
||||||
public PlayerColumn()
|
public PlayerColumn()
|
||||||
{
|
{
|
||||||
@ -20,7 +20,7 @@ public class PlayerColumn : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_playerName = value;
|
_playerName = value;
|
||||||
RaisePropertyChanged(nameof(PlayerName));
|
OnPropertyChanged(nameof(PlayerName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public List<string> Values
|
public List<string> Values
|
||||||
@ -29,7 +29,7 @@ public class PlayerColumn : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_values = value;
|
_values = value;
|
||||||
RaisePropertyChanged(nameof(Values));
|
OnPropertyChanged(nameof(Values));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ public class PlayerColumn : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_playerId = value;
|
_playerId = value;
|
||||||
RaisePropertyChanged(nameof(PlayerId));
|
OnPropertyChanged(nameof(PlayerId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
using Common.Library;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
namespace GreadyPoang.EntityLayer;
|
namespace GreadyPoang.EntityLayer;
|
||||||
|
|
||||||
public class RoundBuilderElement : EntityBase
|
public class RoundBuilderElement : ObservableObject
|
||||||
{
|
{
|
||||||
public RoundBuilderElement()
|
public RoundBuilderElement()
|
||||||
{
|
{
|
||||||
@ -31,7 +31,7 @@ public class RoundBuilderElement : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_participantId = value;
|
_participantId = value;
|
||||||
RaisePropertyChanged(nameof(ParticipantId));
|
OnPropertyChanged(nameof(ParticipantId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ public class RoundBuilderElement : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_participantName = value;
|
_participantName = value;
|
||||||
RaisePropertyChanged(nameof(ParticipantName));
|
OnPropertyChanged(nameof(ParticipantName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ public class RoundBuilderElement : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_gameRoundRegNr = value;
|
_gameRoundRegNr = value;
|
||||||
RaisePropertyChanged(nameof(GameRoundRegNr));
|
OnPropertyChanged(nameof(GameRoundRegNr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ public class RoundBuilderElement : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_gameRegPoints = value;
|
_gameRegPoints = value;
|
||||||
RaisePropertyChanged(nameof(GameRegPoints));
|
OnPropertyChanged(nameof(GameRegPoints));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,8 +75,8 @@ public class RoundBuilderElement : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_status = value;
|
_status = value;
|
||||||
RaisePropertyChanged(nameof(Status));
|
OnPropertyChanged(nameof(Status));
|
||||||
RaisePropertyChanged(nameof(StatusString));
|
OnPropertyChanged(nameof(StatusString));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,8 +91,8 @@ public class RoundBuilderElement : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_gameRoundStartDate = value;
|
_gameRoundStartDate = value;
|
||||||
RaisePropertyChanged(nameof(GameRoundStartDate));
|
OnPropertyChanged(nameof(GameRoundStartDate));
|
||||||
RaisePropertyChanged(nameof(GameRoundStartDateString));
|
OnPropertyChanged(nameof(GameRoundStartDateString));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ public class RoundBuilderElement : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_gameRoundId = value;
|
_gameRoundId = value;
|
||||||
RaisePropertyChanged(nameof(GameRoundId));
|
OnPropertyChanged(nameof(GameRoundId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ public class RoundBuilderElement : EntityBase
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_gamePointId = value;
|
_gamePointId = value;
|
||||||
RaisePropertyChanged(nameof(GamePointId));
|
OnPropertyChanged(nameof(GamePointId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,20 +1,21 @@
|
|||||||
using Common.Library;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
namespace GreadyPoang.EntityLayer;
|
namespace GreadyPoang.EntityLayer;
|
||||||
|
|
||||||
public class RoundBuilderGroup : EntityBase
|
public partial class RoundBuilderGroup : ObservableObject
|
||||||
{
|
{
|
||||||
public RoundBuilderGroup()
|
public RoundBuilderGroup()
|
||||||
{
|
{
|
||||||
_gameRoundId = 0;
|
_gameRoundId = 0;
|
||||||
_gameRoundStartDate = DateTime.MinValue;
|
_gameRoundStartDate = DateTime.MinValue;
|
||||||
_status = GamePointStatus.New;
|
_status = GamePointStatus.New;
|
||||||
_elements = new List<RoundBuilderElement>();
|
Elements = new List<RoundBuilderElement>();
|
||||||
}
|
}
|
||||||
private int _gameRoundId;
|
private int _gameRoundId;
|
||||||
private DateTime _gameRoundStartDate;
|
private DateTime _gameRoundStartDate;
|
||||||
private GamePointStatus _status;
|
private GamePointStatus _status;
|
||||||
private List<RoundBuilderElement> _elements;
|
[ObservableProperty]
|
||||||
|
private List<RoundBuilderElement> elements;
|
||||||
public int GameRoundId
|
public int GameRoundId
|
||||||
{
|
{
|
||||||
get { return _gameRoundId; }
|
get { return _gameRoundId; }
|
||||||
@ -43,14 +44,14 @@ public class RoundBuilderGroup : EntityBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RoundBuilderElement> Elements
|
//public List<RoundBuilderElement> Elements
|
||||||
{
|
//{
|
||||||
get { return _elements; }
|
// get { return _elements; }
|
||||||
set
|
// set
|
||||||
{
|
// {
|
||||||
_elements = value;
|
// _elements = value;
|
||||||
RaisePropertyChanged(nameof(Elements));
|
// OnPropertyChanged(nameof(Elements));
|
||||||
// No need to raise property changed for this example
|
// // No need to raise property changed for this example
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.8">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.8">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
|||||||
@ -6,6 +6,10 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\GreadyPoang.EntityLayer\GreadyPoang.EntityLayer.csproj" />
|
<ProjectReference Include="..\GreadyPoang.EntityLayer\GreadyPoang.EntityLayer.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@ -6,6 +6,10 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Common.Library\Common.Library.csproj" />
|
<ProjectReference Include="..\Common.Library\Common.Library.csproj" />
|
||||||
<ProjectReference Include="..\GreadyPoang.DataLayer\GreadyPoang.DataLayer.csproj" />
|
<ProjectReference Include="..\GreadyPoang.DataLayer\GreadyPoang.DataLayer.csproj" />
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
using Common.Library;
|
using Common.Library;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using GreadyPoang.EntityLayer;
|
using GreadyPoang.EntityLayer;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
namespace GreadyPoang.ViewModelLayer;
|
namespace GreadyPoang.ViewModelLayer;
|
||||||
|
|
||||||
public class MethodSharingService : ViewModelBase, IMethodSharingService<Participant>
|
public class MethodSharingService : ObservableObject, IMethodSharingService<Participant>
|
||||||
{
|
{
|
||||||
private readonly IRepository<Participant> _repository;
|
private readonly IRepository<Participant> _repository;
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
using Common.Library;
|
using Common.Library;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using GreadyPoang.EntityLayer;
|
using GreadyPoang.EntityLayer;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
|
|
||||||
namespace GreadyPoang.ViewModelLayer;
|
namespace GreadyPoang.ViewModelLayer;
|
||||||
|
|
||||||
public class ParticipantViewModel : ViewModelBase
|
public partial class ParticipantViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
#region Constructors
|
#region Constructors
|
||||||
public ParticipantViewModel() : base()
|
public ParticipantViewModel() : base()
|
||||||
@ -17,41 +18,21 @@ public class ParticipantViewModel : ViewModelBase
|
|||||||
{
|
{
|
||||||
_Repository = repo;
|
_Repository = repo;
|
||||||
_sharingService = sharingService;
|
_sharingService = sharingService;
|
||||||
|
ParticipantObject = new Participant();
|
||||||
|
ParticipantList = new ObservableCollection<Participant>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private Variables
|
#region Private Variables
|
||||||
private Participant? _ParticipantObject = new();
|
[ObservableProperty]
|
||||||
private ObservableCollection<Participant> _ParticipantList = new();
|
private Participant? participantObject;
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<Participant> participantList;
|
||||||
private readonly IRepository<Participant>? _Repository;
|
private readonly IRepository<Participant>? _Repository;
|
||||||
private readonly IMethodSharingService<Participant> _sharingService;
|
private readonly IMethodSharingService<Participant> _sharingService;
|
||||||
#endregion
|
#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
|
#region Get Method
|
||||||
public ObservableCollection<Participant> Get()
|
public ObservableCollection<Participant> Get()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Common.Library;
|
using Common.Library;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using GreadyPoang.DataLayer;
|
using GreadyPoang.DataLayer;
|
||||||
using GreadyPoang.EntityLayer;
|
using GreadyPoang.EntityLayer;
|
||||||
using GreadyPoang.Services;
|
using GreadyPoang.Services;
|
||||||
@ -7,7 +8,7 @@ using System.Diagnostics;
|
|||||||
|
|
||||||
namespace GreadyPoang.ViewModelLayer;
|
namespace GreadyPoang.ViewModelLayer;
|
||||||
|
|
||||||
public class RoundRunningViewModel : ViewModelBase
|
public partial class RoundRunningViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
|
|
||||||
public event EventHandler RebuildRequested;
|
public event EventHandler RebuildRequested;
|
||||||
@ -30,8 +31,8 @@ public class RoundRunningViewModel : ViewModelBase
|
|||||||
_sharingService = sharingService;
|
_sharingService = sharingService;
|
||||||
_combined = combined;
|
_combined = combined;
|
||||||
_objectMessage = objectMessage;
|
_objectMessage = objectMessage;
|
||||||
_roundElements = new ObservableCollection<RoundBuilderElement>();
|
RoundElements = new ObservableCollection<RoundBuilderElement>();
|
||||||
_builderObject = new();
|
BuilderObject = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly IRepository<GameRound>? _roundsRepo;
|
private readonly IRepository<GameRound>? _roundsRepo;
|
||||||
@ -40,11 +41,15 @@ public class RoundRunningViewModel : ViewModelBase
|
|||||||
private readonly ICombinedRepository _combined;
|
private readonly ICombinedRepository _combined;
|
||||||
private readonly IObjectMessageService _objectMessage;
|
private readonly IObjectMessageService _objectMessage;
|
||||||
|
|
||||||
private ObservableCollection<RoundBuilderGroup> _GameRoundList = new();
|
//private ObservableCollection<RoundBuilderGroup> _GameRoundList = new();
|
||||||
private ObservableCollection<Participant> _ParticipantList = new();
|
//private ObservableCollection<Participant> _ParticipantList = new();
|
||||||
private ObservableCollection<RoundBuilderElement> _roundElements;
|
|
||||||
private Collection<PlayerColumn> _playerColumns;
|
[ObservableProperty]
|
||||||
private RoundBuilderElement _builderObject;
|
private ObservableCollection<RoundBuilderElement> roundElements;
|
||||||
|
[ObservableProperty]
|
||||||
|
private Collection<PlayerColumn> playerColumns;
|
||||||
|
[ObservableProperty]
|
||||||
|
private RoundBuilderElement builderObject;
|
||||||
|
|
||||||
public void TriggerRebuild()
|
public void TriggerRebuild()
|
||||||
{
|
{
|
||||||
@ -52,35 +57,35 @@ public class RoundRunningViewModel : ViewModelBase
|
|||||||
RebuildRequested?.Invoke(this, EventArgs.Empty);
|
RebuildRequested?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObservableCollection<RoundBuilderElement> RoundElements
|
//public ObservableCollection<RoundBuilderElement> RoundElements
|
||||||
{
|
//{
|
||||||
get { return _roundElements; }
|
// get { return _roundElements; }
|
||||||
set
|
// set
|
||||||
{
|
// {
|
||||||
_roundElements = value;
|
// _roundElements = value;
|
||||||
RaisePropertyChanged(nameof(RoundElements));
|
// OnPropertyChanged(nameof(RoundElements));
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
public Collection<PlayerColumn> PlayerColumns
|
//public Collection<PlayerColumn> PlayerColumns
|
||||||
{
|
//{
|
||||||
get { return _playerColumns; }
|
// get { return _playerColumns; }
|
||||||
set
|
// set
|
||||||
{
|
// {
|
||||||
_playerColumns = value;
|
// _playerColumns = value;
|
||||||
RaisePropertyChanged(nameof(PlayerColumns));
|
// OnPropertyChanged(nameof(PlayerColumns));
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
public RoundBuilderElement BuilderObject
|
//public RoundBuilderElement BuilderObject
|
||||||
{
|
//{
|
||||||
get { return _builderObject; }
|
// get { return _builderObject; }
|
||||||
set
|
// set
|
||||||
{
|
// {
|
||||||
_builderObject = value;
|
// _builderObject = value;
|
||||||
RaisePropertyChanged(nameof(BuilderObject));
|
// OnPropertyChanged(nameof(BuilderObject));
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
public ObservableCollection<RoundBuilderElement> Get()
|
public ObservableCollection<RoundBuilderElement> Get()
|
||||||
@ -97,7 +102,7 @@ public class RoundRunningViewModel : ViewModelBase
|
|||||||
}
|
}
|
||||||
foreach (var item in _objectMessage.CurrentGroup.Elements)
|
foreach (var item in _objectMessage.CurrentGroup.Elements)
|
||||||
{
|
{
|
||||||
_roundElements.Add(item);
|
RoundElements.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Räkna ut vem som är nästa spelare
|
// Räkna ut vem som är nästa spelare
|
||||||
@ -113,7 +118,7 @@ public class RoundRunningViewModel : ViewModelBase
|
|||||||
var localElements = _combined.roundBuilderElementsTotalById(_objectMessage.CurrentGroup.GameRoundId);
|
var localElements = _combined.roundBuilderElementsTotalById(_objectMessage.CurrentGroup.GameRoundId);
|
||||||
|
|
||||||
FillupResultTable(localElements);
|
FillupResultTable(localElements);
|
||||||
foreach (var col in _playerColumns)
|
foreach (var col in PlayerColumns)
|
||||||
{
|
{
|
||||||
RoundElements.FirstOrDefault(e => e.ParticipantId == col.PlayerId).GameRegPoints = col.PlayerPoints;
|
RoundElements.FirstOrDefault(e => e.ParticipantId == col.PlayerId).GameRegPoints = col.PlayerPoints;
|
||||||
}
|
}
|
||||||
@ -166,7 +171,7 @@ public class RoundRunningViewModel : ViewModelBase
|
|||||||
|
|
||||||
var localElements = _combined.roundBuilderElementsTotalById(BuilderObject.GameRoundId);
|
var localElements = _combined.roundBuilderElementsTotalById(BuilderObject.GameRoundId);
|
||||||
FillupResultTable(localElements);
|
FillupResultTable(localElements);
|
||||||
foreach (var col in _playerColumns)
|
foreach (var col in PlayerColumns)
|
||||||
{
|
{
|
||||||
RoundElements.FirstOrDefault(e => e.ParticipantId == col.PlayerId).GameRegPoints = col.PlayerPoints;
|
RoundElements.FirstOrDefault(e => e.ParticipantId == col.PlayerId).GameRegPoints = col.PlayerPoints;
|
||||||
}
|
}
|
||||||
@ -189,13 +194,13 @@ public class RoundRunningViewModel : ViewModelBase
|
|||||||
|
|
||||||
private void FillupResultTable(IEnumerable<RoundBuilderElement> elements)
|
private void FillupResultTable(IEnumerable<RoundBuilderElement> elements)
|
||||||
{
|
{
|
||||||
if (_playerColumns != null)
|
if (PlayerColumns != null)
|
||||||
{
|
{
|
||||||
_playerColumns.Clear();
|
PlayerColumns.Clear();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_playerColumns = new Collection<PlayerColumn>();
|
PlayerColumns = new Collection<PlayerColumn>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (elements.Any(g => g.GameRegPoints > 0))
|
// if (elements.Any(g => g.GameRegPoints > 0))
|
||||||
@ -205,7 +210,7 @@ public class RoundRunningViewModel : ViewModelBase
|
|||||||
|
|
||||||
foreach (var element in elements)
|
foreach (var element in elements)
|
||||||
{
|
{
|
||||||
player = _playerColumns.FirstOrDefault(p => p.PlayerId == element.ParticipantId);
|
player = PlayerColumns.FirstOrDefault(p => p.PlayerId == element.ParticipantId);
|
||||||
|
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
@ -224,9 +229,9 @@ public class RoundRunningViewModel : ViewModelBase
|
|||||||
}
|
}
|
||||||
//oldPart = element.ParticipantId;
|
//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
|
var player = new PlayerColumn
|
||||||
{
|
{
|
||||||
PlayerName = element.ParticipantName
|
PlayerName = element.ParticipantName,
|
||||||
|
PlayerId = element.ParticipantId,
|
||||||
|
PlayerPoints = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < slumper.Next(6); i++)
|
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());
|
player.Values.Add(slumper.Next(1, 10).ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
_playerColumns.Add(player);
|
PlayerColumns.Add(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Common.Library;
|
using Common.Library;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using GreadyPoang.DataLayer;
|
using GreadyPoang.DataLayer;
|
||||||
using GreadyPoang.EntityLayer;
|
using GreadyPoang.EntityLayer;
|
||||||
using GreadyPoang.Services;
|
using GreadyPoang.Services;
|
||||||
@ -7,7 +8,7 @@ using System.Diagnostics;
|
|||||||
|
|
||||||
namespace GreadyPoang.ViewModelLayer;
|
namespace GreadyPoang.ViewModelLayer;
|
||||||
|
|
||||||
public class RoundStartingViewModel : ViewModelBase
|
public partial class RoundStartingViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
#region Constructors
|
#region Constructors
|
||||||
public RoundStartingViewModel() : base()
|
public RoundStartingViewModel() : base()
|
||||||
@ -27,52 +28,100 @@ public class RoundStartingViewModel : ViewModelBase
|
|||||||
_sharingService = sharingService;
|
_sharingService = sharingService;
|
||||||
_combined = combined;
|
_combined = combined;
|
||||||
_objectMessage = objectMessage;
|
_objectMessage = objectMessage;
|
||||||
_roundElements = new ObservableCollection<RoundBuilderElement>();
|
RoundElements = new ObservableCollection<RoundBuilderElement>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private GameRound? _GameRoundObject = new();
|
|
||||||
private ObservableCollection<RoundBuilderGroup> _GameRoundList = new();
|
|
||||||
private ObservableCollection<Participant> _ParticipantList = new();
|
|
||||||
private readonly IRepository<GameRound>? _roundsRepo;
|
private readonly IRepository<GameRound>? _roundsRepo;
|
||||||
private readonly IRepository<GamePoint> _pointsRepo;
|
private readonly IRepository<GamePoint> _pointsRepo;
|
||||||
private readonly IMethodSharingService<Participant> _sharingService;
|
private readonly IMethodSharingService<Participant> _sharingService;
|
||||||
private readonly ICombinedRepository _combined;
|
private readonly ICombinedRepository _combined;
|
||||||
private readonly IObjectMessageService _objectMessage;
|
private readonly IObjectMessageService _objectMessage;
|
||||||
private Participant _selectedItem;
|
|
||||||
|
|
||||||
private ObservableCollection<RoundBuilderElement> _roundElements;
|
[ObservableProperty]
|
||||||
|
private Participant selectedItem;
|
||||||
public ObservableCollection<RoundBuilderElement> RoundElements
|
partial void OnSelectedItemChanged(Participant value)
|
||||||
{
|
{
|
||||||
get { return _roundElements; }
|
if (value != null)
|
||||||
set
|
|
||||||
{
|
{
|
||||||
_roundElements = value;
|
OnItemSelected(value);
|
||||||
RaisePropertyChanged(nameof(RoundElements));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<RoundBuilderElement> roundElements;
|
||||||
|
|
||||||
public Participant SelectedItem
|
[ObservableProperty]
|
||||||
{
|
private GameRound? gameRoundObject = new();
|
||||||
get => _selectedItem;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_selectedItem != value)
|
|
||||||
{
|
|
||||||
|
|
||||||
_selectedItem = value;
|
[ObservableProperty]
|
||||||
RaisePropertyChanged(nameof(SelectedItem));
|
private ObservableCollection<RoundBuilderGroup> gameRoundList = new();
|
||||||
OnItemSelected(value); // Metod som triggas vid val
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<Participant> participantList = new();
|
||||||
|
|
||||||
|
|
||||||
|
#region commented out
|
||||||
|
|
||||||
|
//public ObservableCollection<RoundBuilderElement> 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<RoundBuilderGroup> GameRoundList
|
||||||
|
//{
|
||||||
|
// get { return _GameRoundList; }
|
||||||
|
// set
|
||||||
|
// {
|
||||||
|
// _GameRoundList = value;
|
||||||
|
// OnPropertyChanged(nameof(GameRoundList));
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//public ObservableCollection<Participant> ParticipantList
|
||||||
|
//{
|
||||||
|
// get { return _ParticipantList; }
|
||||||
|
// set
|
||||||
|
// {
|
||||||
|
// _ParticipantList = value;
|
||||||
|
// OnPropertyChanged(nameof(ParticipantList));
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
#endregion
|
||||||
private void OnItemSelected(Participant item)
|
private void OnItemSelected(Participant item)
|
||||||
{
|
{
|
||||||
if (_roundElements.Count == 0)
|
if (RoundElements.Count == 0)
|
||||||
{
|
{
|
||||||
var GameRound = new GameRound
|
var GameRound = new GameRound
|
||||||
{
|
{
|
||||||
@ -110,42 +159,12 @@ public class RoundStartingViewModel : ViewModelBase
|
|||||||
newElement.GameRoundId = GamePointStart.GameRoundId;
|
newElement.GameRoundId = GamePointStart.GameRoundId;
|
||||||
newElement.GamePointId = GamePointStart.GamePointId;
|
newElement.GamePointId = GamePointStart.GamePointId;
|
||||||
|
|
||||||
_roundElements.Add(newElement);
|
RoundElements.Add(newElement);
|
||||||
// Gör något med det valda objektet
|
// Gör något med det valda objektet
|
||||||
Debug.WriteLine($"Du valde: {item.LastNameFirstName}");
|
Debug.WriteLine($"Du valde: {item.LastNameFirstName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public GameRound? GameRoundObject
|
|
||||||
{
|
|
||||||
get { return _GameRoundObject; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_GameRoundObject = value;
|
|
||||||
RaisePropertyChanged(nameof(GameRoundObject));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObservableCollection<RoundBuilderGroup> GameRoundList
|
|
||||||
{
|
|
||||||
get { return _GameRoundList; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_GameRoundList = value;
|
|
||||||
RaisePropertyChanged(nameof(GameRoundList));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObservableCollection<Participant> ParticipantList
|
|
||||||
{
|
|
||||||
get { return _ParticipantList; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_ParticipantList = value;
|
|
||||||
RaisePropertyChanged(nameof(ParticipantList));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Get Method
|
#region Get Method
|
||||||
public ObservableCollection<RoundBuilderGroup> Get()
|
public ObservableCollection<RoundBuilderGroup> Get()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
using Common.Library;
|
using Common.Library;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using GreadyPoang.EntityLayer;
|
using GreadyPoang.EntityLayer;
|
||||||
using GreadyPoang.ViewModelLayer;
|
using GreadyPoang.ViewModelLayer;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace GreadyPoang.CommandClasses;
|
namespace GreadyPoang.CommandClasses;
|
||||||
|
|
||||||
public class ParticipantViewModelCommands : ParticipantViewModel
|
public partial class ParticipantViewModelCommands : ParticipantViewModel
|
||||||
{
|
{
|
||||||
#region constructors
|
#region constructors
|
||||||
public ParticipantViewModelCommands() : base()
|
public ParticipantViewModelCommands() : base()
|
||||||
@ -14,24 +15,15 @@ public class ParticipantViewModelCommands : ParticipantViewModel
|
|||||||
}
|
}
|
||||||
public ParticipantViewModelCommands(IRepository<Participant> repo, IMethodSharingService<Participant> sharingService) : base(repo, sharingService)
|
public ParticipantViewModelCommands(IRepository<Participant> repo, IMethodSharingService<Participant> sharingService) : base(repo, sharingService)
|
||||||
{
|
{
|
||||||
|
Init();
|
||||||
|
IsSaveCommandEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private Variables
|
#region Private Variables
|
||||||
private bool _IsSaveCommandEnabled = true;
|
[ObservableProperty]
|
||||||
#endregion
|
private bool isSaveCommandEnabled;
|
||||||
|
|
||||||
#region Public Properties
|
|
||||||
public bool IsSaveCommandEnabled
|
|
||||||
{
|
|
||||||
get { return _IsSaveCommandEnabled; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_IsSaveCommandEnabled = value;
|
|
||||||
RaisePropertyChanged(nameof(IsSaveCommandEnabled));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Commands
|
#region Commands
|
||||||
@ -40,9 +32,9 @@ public class ParticipantViewModelCommands : ParticipantViewModel
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Init Method
|
#region Init Method
|
||||||
public override void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
base.Init();
|
//base.Init();
|
||||||
SaveCommand = new Command(async () => SaveAsync(), () => IsSaveCommandEnabled);
|
SaveCommand = new Command(async () => SaveAsync(), () => IsSaveCommandEnabled);
|
||||||
EditCommand = new Command<int>(async (id) => await EditAsync(id), (id) => id > 0);
|
EditCommand = new Command<int>(async (id) => await EditAsync(id), (id) => id > 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,27 +25,22 @@ public class RoundRunningViewModelCommands : RoundRunningViewModel
|
|||||||
combined,
|
combined,
|
||||||
objectMessage)
|
objectMessage)
|
||||||
{
|
{
|
||||||
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Commands
|
#region Commands
|
||||||
public ICommand SaveCommand { get; private set; }
|
//public ICommand SaveCommand { get; private set; }
|
||||||
public ICommand EditCommand { get; private set; }
|
//public ICommand EditCommand { get; private set; }
|
||||||
public ICommand RensaCommand { get; private set; }
|
//public ICommand RensaCommand { get; private set; }
|
||||||
public ICommand ElementTappedCommand { get; private set; }
|
//public ICommand ElementTappedCommand { get; private set; }
|
||||||
public ICommand ParticipantTappedCommand { get; private set; }
|
//public ICommand ParticipantTappedCommand { get; private set; }
|
||||||
public ICommand StoreAndHandlePointsCommand { get; private set; }
|
public ICommand StoreAndHandlePointsCommand { get; private set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public override void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
base.Init();
|
|
||||||
StoreAndHandlePointsCommand = new Command(async () => StoreAndHandleAsync());
|
StoreAndHandlePointsCommand = new Command(async () => StoreAndHandleAsync());
|
||||||
//EditCommand = new Command<int>(async (id) => await EditAsync(id), (id) => id > 0);
|
|
||||||
//RensaCommand = new Command(async () => RensaAsync());
|
|
||||||
//ParticipantTappedCommand = new Command<RoundBuilderElement>(async (selectedParticipant) => SelectNewlyAddedParticipant(selectedParticipant));
|
|
||||||
//ElementTappedCommand = new Command<RoundBuilderElement>((selectedElement) => RoundSelected(selectedElement));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task StoreAndHandleAsync()
|
private async Task StoreAndHandleAsync()
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Common.Library;
|
using Common.Library;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using GreadyPoang.DataLayer;
|
using GreadyPoang.DataLayer;
|
||||||
using GreadyPoang.EntityLayer;
|
using GreadyPoang.EntityLayer;
|
||||||
using GreadyPoang.Services;
|
using GreadyPoang.Services;
|
||||||
@ -7,7 +8,7 @@ using System.Windows.Input;
|
|||||||
|
|
||||||
namespace GreadyPoang.CommandClasses;
|
namespace GreadyPoang.CommandClasses;
|
||||||
|
|
||||||
public class RoundStartingViewModelCommands : RoundStartingViewModel
|
public partial class RoundStartingViewModelCommands : RoundStartingViewModel
|
||||||
{
|
{
|
||||||
public RoundStartingViewModelCommands() : base()
|
public RoundStartingViewModelCommands() : base()
|
||||||
{
|
{
|
||||||
@ -25,23 +26,13 @@ public class RoundStartingViewModelCommands : RoundStartingViewModel
|
|||||||
combined,
|
combined,
|
||||||
objectMessage)
|
objectMessage)
|
||||||
{
|
{
|
||||||
|
Init();
|
||||||
|
IsSaveCommandEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Private Variables
|
#region Private Variables
|
||||||
private bool _IsSaveCommandEnabled = true;
|
[ObservableProperty]
|
||||||
#endregion
|
private bool isSaveCommandEnabled;
|
||||||
|
|
||||||
#region Public Properties
|
|
||||||
public bool IsSaveCommandEnabled
|
|
||||||
{
|
|
||||||
get { return _IsSaveCommandEnabled; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_IsSaveCommandEnabled = value;
|
|
||||||
RaisePropertyChanged(nameof(IsSaveCommandEnabled));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Commands
|
#region Commands
|
||||||
@ -53,9 +44,10 @@ public class RoundStartingViewModelCommands : RoundStartingViewModel
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Init Method
|
#region Init Method
|
||||||
public override void Init()
|
|
||||||
|
public void Init()
|
||||||
{
|
{
|
||||||
base.Init();
|
//base.Init();
|
||||||
SaveCommand = new Command(async () => SaveAsync(), () => IsSaveCommandEnabled);
|
SaveCommand = new Command(async () => SaveAsync(), () => IsSaveCommandEnabled);
|
||||||
EditCommand = new Command<int>(async (id) => await EditAsync(id), (id) => id > 0);
|
EditCommand = new Command<int>(async (id) => await EditAsync(id), (id) => id > 0);
|
||||||
RensaCommand = new Command(async () => RensaAsync());
|
RensaCommand = new Command(async () => RensaAsync());
|
||||||
|
|||||||
@ -60,6 +60,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.100" />
|
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.100" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.8" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.8" />
|
||||||
|
|||||||
Reference in New Issue
Block a user