Compare commits
16 Commits
master
...
6df80917ee
| Author | SHA1 | Date | |
|---|---|---|---|
| 6df80917ee | |||
| f48869205e | |||
| d586c96ddf | |||
| 5ff42f5bca | |||
| 26ff51169f | |||
| ecd3e90dbf | |||
| 2797162a93 | |||
| 735788969a | |||
| a8ca07a1bf | |||
| bb8f4bd5ed | |||
| 21eb0d5498 | |||
| b4d6c6d530 | |||
| b2dbb9993f | |||
| f5cc28f202 | |||
| 469b0b3377 | |||
| ae05adc823 |
@ -1,29 +0,0 @@
|
|||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
namespace Common.Library;
|
|
||||||
|
|
||||||
public abstract class CommonBase : INotifyPropertyChanged
|
|
||||||
{
|
|
||||||
#region Constructor
|
|
||||||
protected CommonBase()
|
|
||||||
{
|
|
||||||
Init();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Init Method
|
|
||||||
public virtual void Init()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region RaisePropertyChanged Method
|
|
||||||
public event PropertyChangedEventHandler? PropertyChanged;
|
|
||||||
public virtual void RaisePropertyChanged(string propertyName)
|
|
||||||
{
|
|
||||||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
namespace Common.Library;
|
|
||||||
|
|
||||||
public class EntityBase : CommonBase
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
//using GreadyPoang.DataLayer;
|
|
||||||
|
|
||||||
namespace Common.Library;
|
|
||||||
public class ViewModelBase : CommonBase
|
|
||||||
{
|
|
||||||
//private readonly LocalDbService _dbService;
|
|
||||||
|
|
||||||
//public ViewModelBase(LocalDbService dbService)
|
|
||||||
//{
|
|
||||||
// _dbService = dbService;
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -6,5 +6,10 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommunityToolkit.Maui" Version="12.2.0" />
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
39
Common.Library/Core/BaseViewModel.cs
Normal file
39
Common.Library/Core/BaseViewModel.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using CommunityToolkit.Maui.Alerts;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
namespace GreadyPoang.Core;
|
||||||
|
public partial class BaseViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool isBusy;
|
||||||
|
|
||||||
|
protected async Task RunAsyncCommand(Func<Task> action, string loadingMessage = null, string errorMessage = "Ett fel inträffade")
|
||||||
|
{
|
||||||
|
if (IsBusy) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IsBusy = true;
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(loadingMessage))
|
||||||
|
await Snackbar.Make(
|
||||||
|
message: loadingMessage,
|
||||||
|
duration: TimeSpan.FromSeconds(2),
|
||||||
|
action: null).Show();
|
||||||
|
|
||||||
|
await action.Invoke();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await Snackbar.Make(
|
||||||
|
message: $"{errorMessage}: {ex.Message}",
|
||||||
|
duration: TimeSpan.FromSeconds(3),
|
||||||
|
action: () => Console.WriteLine("Åtgärd vald")).Show();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IsBusy = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -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>
|
||||||
|
|
||||||
|
|||||||
12
GreadyPoang.Common/Specifics/HeaderColorConverter.cs
Normal file
12
GreadyPoang.Common/Specifics/HeaderColorConverter.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace GreadyPoang.Common;
|
||||||
|
|
||||||
|
public class HeaderColorConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
|
||||||
|
(bool)value ? Colors.DarkGray : Colors.Yellow;
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) =>
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
35
GreadyPoang.Common/Specifics/LoadedBehavior.cs
Normal file
35
GreadyPoang.Common/Specifics/LoadedBehavior.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace GreadyPoang.Common;
|
||||||
|
|
||||||
|
public class LoadedBehavior
|
||||||
|
{
|
||||||
|
public static readonly BindableProperty CommandProperty =
|
||||||
|
BindableProperty.CreateAttached(
|
||||||
|
"Command",
|
||||||
|
typeof(ICommand),
|
||||||
|
typeof(LoadedBehavior),
|
||||||
|
null,
|
||||||
|
propertyChanged: OnCommandChanged);
|
||||||
|
|
||||||
|
public static ICommand GetCommand(BindableObject view) =>
|
||||||
|
(ICommand)view.GetValue(CommandProperty);
|
||||||
|
|
||||||
|
public static void SetCommand(BindableObject view, ICommand value) =>
|
||||||
|
view.SetValue(CommandProperty, value);
|
||||||
|
|
||||||
|
private static void OnCommandChanged(BindableObject bindable, object oldValue, object newValue)
|
||||||
|
{
|
||||||
|
if (bindable is VisualElement element && newValue is ICommand command)
|
||||||
|
{
|
||||||
|
element.Loaded += (s, e) =>
|
||||||
|
{
|
||||||
|
if (command.CanExecute(null))
|
||||||
|
{
|
||||||
|
command.Execute(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -52,14 +52,14 @@ public class CombinedRepository : ICombinedRepository
|
|||||||
gp.GamePointId,
|
gp.GamePointId,
|
||||||
gp.GameRoundId,
|
gp.GameRoundId,
|
||||||
gp.GameRoundRegNr,
|
gp.GameRoundRegNr,
|
||||||
gp.GameRegPoints,
|
latest.totPoints as GameRegPoints,
|
||||||
gr.GameRoundStartDate,
|
gr.GameRoundStartDate,
|
||||||
gr.GameStatus AS Status,
|
gr.GameStatus AS Status,
|
||||||
p.ParticipantId,
|
p.ParticipantId,
|
||||||
(p.LastName || ' ' || p.FirstName) AS ParticipantName
|
(p.LastName || ' ' || p.FirstName) AS ParticipantName
|
||||||
FROM GamePoints gp
|
FROM GamePoints gp
|
||||||
INNER JOIN (
|
INNER JOIN (
|
||||||
SELECT ParticipantId, GameRoundId, MAX(GamePointId) AS MaxGamePointId
|
SELECT ParticipantId, GameRoundId, MAX(GamePointId) AS MaxGamePointId, sum(GameRegPoints) AS totPoints
|
||||||
FROM GamePoints
|
FROM GamePoints
|
||||||
GROUP BY ParticipantId, GameRoundId
|
GROUP BY ParticipantId, GameRoundId
|
||||||
) latest ON gp.GamePointId = latest.MaxGamePointId
|
) latest ON gp.GamePointId = latest.MaxGamePointId
|
||||||
|
|||||||
@ -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,97 +1,42 @@
|
|||||||
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 partial class GamePoint : ObservableObject
|
||||||
{
|
{
|
||||||
public GamePoint()
|
public GamePoint()
|
||||||
{
|
{
|
||||||
_gamePointId = 0;
|
GamePointId = 0;
|
||||||
_participantId = 0;
|
ParticipantId = 0;
|
||||||
_gameRoundId = 0;
|
GameRoundId = 0;
|
||||||
_gameDate = DateTime.Now;
|
GameDate = DateTime.Now;
|
||||||
_gameRoundRegNr = 0;
|
GameRoundRegNr = 0;
|
||||||
_gameRegPoints = 0;
|
GameRegPoints = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _gamePointId;
|
[ObservableProperty]
|
||||||
private int _participantId;
|
[property: PrimaryKey, AutoIncrement, Column("GamePointId")]
|
||||||
private int _gameRoundId;
|
private int gamePointId;
|
||||||
private DateTime _gameDate;
|
|
||||||
private int _gameRoundRegNr;
|
|
||||||
private int _gameRegPoints;
|
|
||||||
|
|
||||||
[PrimaryKey]
|
[ObservableProperty]
|
||||||
[AutoIncrement]
|
[property: Column("ParticipantId")]
|
||||||
[Column("GamePointId")]
|
private int participantId;
|
||||||
public int GamePointId
|
|
||||||
{
|
|
||||||
get { return _gamePointId; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gamePointId = value;
|
|
||||||
RaisePropertyChanged(nameof(GamePointId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Column("ParticipantId")]
|
[ObservableProperty]
|
||||||
public int ParticipantId
|
[property: Column("GameRoundId")]
|
||||||
{
|
private int gameRoundId;
|
||||||
get { return _participantId; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_participantId = value;
|
|
||||||
RaisePropertyChanged(nameof(ParticipantId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
[Column("GameRoundId")]
|
|
||||||
public int GameRoundId
|
|
||||||
{
|
|
||||||
get { return _gameRoundId; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gameRoundId = value;
|
|
||||||
RaisePropertyChanged(nameof(GameRoundId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Column("GameDate")]
|
[ObservableProperty]
|
||||||
public DateTime GameDate
|
[property: Column("GameDate")]
|
||||||
{
|
private DateTime gameDate;
|
||||||
get { return _gameDate; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gameDate = value;
|
|
||||||
RaisePropertyChanged(nameof(GameDate));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameRoundRegNr räknas upp när en spelare får en ny gamepoint inlagd
|
|
||||||
// Alltså hans/hennes senaste i samma runda uppräknad med 1
|
|
||||||
|
|
||||||
[Column("GameRoundRegNr")]
|
|
||||||
public int GameRoundRegNr
|
|
||||||
{
|
|
||||||
get { return _gameRoundRegNr; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gameRoundRegNr = value;
|
|
||||||
RaisePropertyChanged(nameof(GameRoundRegNr));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Column("GameRegPoints")]
|
|
||||||
public int GameRegPoints
|
|
||||||
{
|
|
||||||
get { return _gameRegPoints; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gameRegPoints = value;
|
|
||||||
RaisePropertyChanged(nameof(GameRegPoints));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
[property: Column("GameRoundRegNr")]
|
||||||
|
private int gameRoundRegNr;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
[property: Column("GameRegPoints")]
|
||||||
|
private int gameRegPoints;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using Common.Library;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using SQLite;
|
using SQLite;
|
||||||
|
|
||||||
namespace GreadyPoang.EntityLayer;
|
namespace GreadyPoang.EntityLayer;
|
||||||
@ -6,72 +6,34 @@ namespace GreadyPoang.EntityLayer;
|
|||||||
|
|
||||||
[Table("GameRound")]
|
[Table("GameRound")]
|
||||||
|
|
||||||
public class GameRound : EntityBase
|
public partial class GameRound : ObservableObject
|
||||||
{
|
{
|
||||||
public GameRound()
|
public GameRound()
|
||||||
{
|
{
|
||||||
_gameRoundId = 0;
|
GameRoundId = 0;
|
||||||
_gameRoundStartDate = DateTime.Now;
|
GameRoundStartDate = DateTime.Now;
|
||||||
_gameStatus = GamePointStatus.New;
|
GameStatus = GamePointStatus.New;
|
||||||
_gameRoundFinished = null;
|
GameRoundFinished = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _gameRoundId;
|
[ObservableProperty]
|
||||||
private DateTime _gameRoundStartDate;
|
[property: PrimaryKey, AutoIncrement, Column("GameRoundId")]
|
||||||
private GamePointStatus _gameStatus;
|
private int gameRoundId;
|
||||||
private DateTime? _gameRoundFinished;
|
|
||||||
|
|
||||||
[Column("GameRoundFinished")]
|
[ObservableProperty]
|
||||||
public DateTime? GameRoundFinished
|
[property: Column("GameRoundStartDate")]
|
||||||
{
|
private DateTime gameRoundStartDate;
|
||||||
get { return _gameRoundFinished; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gameRoundFinished = value;
|
|
||||||
RaisePropertyChanged(nameof(GameRoundFinished));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Column("GameRoundStartDate")]
|
[ObservableProperty]
|
||||||
public DateTime GameRoundStartDate
|
[property: Column("GameStatus")]
|
||||||
{
|
private GamePointStatus gameStatus;
|
||||||
get { return _gameRoundStartDate; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gameRoundStartDate = value;
|
|
||||||
RaisePropertyChanged(nameof(GameRoundStartDate));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Column("GameStatus")]
|
[ObservableProperty]
|
||||||
public GamePointStatus GameStatus
|
[property: Column("GameRoundFinished")]
|
||||||
{
|
private DateTime? gameRoundFinished;
|
||||||
get { return _gameStatus; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gameStatus = value;
|
|
||||||
RaisePropertyChanged(nameof(GameStatus));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[PrimaryKey]
|
|
||||||
[AutoIncrement]
|
|
||||||
[Column("GameRoundId")]
|
|
||||||
public int GameRoundId
|
|
||||||
{
|
|
||||||
get { return _gameRoundId; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gameRoundId = value;
|
|
||||||
RaisePropertyChanged(nameof(GameRoundId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GameRoundStartDateString
|
public string GameRoundStartDateString
|
||||||
{
|
{
|
||||||
get { return _gameRoundStartDate.ToString("yyyy-MM-dd"); }
|
get { return GameRoundStartDate.ToString("yyyy-MM-dd"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,67 +1,32 @@
|
|||||||
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 partial class Participant : ObservableObject
|
||||||
{
|
{
|
||||||
public Participant()
|
public Participant()
|
||||||
{
|
{
|
||||||
_firstName = string.Empty;
|
FirstName = string.Empty;
|
||||||
_lastName = string.Empty;
|
LastName = string.Empty;
|
||||||
_email = string.Empty;
|
Email = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _participantId;
|
[ObservableProperty]
|
||||||
private string _firstName;
|
[property: PrimaryKey, AutoIncrement, Column("ParticipantId")]
|
||||||
private string _lastName;
|
private int participantId;
|
||||||
private string _email;
|
|
||||||
|
|
||||||
[PrimaryKey]
|
[ObservableProperty]
|
||||||
[AutoIncrement]
|
[property: Column("FirstName")]
|
||||||
[Column("ParticipantId")]
|
private string firstName;
|
||||||
public int ParticipantId
|
|
||||||
{
|
|
||||||
get { return _participantId; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_participantId = value;
|
|
||||||
RaisePropertyChanged(nameof(ParticipantId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Column("FirstName")]
|
[ObservableProperty]
|
||||||
public string FirstName
|
[property: Column("LastName")]
|
||||||
{
|
private string lastName;
|
||||||
get { return _firstName; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_firstName = value;
|
|
||||||
RaisePropertyChanged(nameof(FirstName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Column("LastName")]
|
[ObservableProperty]
|
||||||
public string LastName
|
[property: Column("Email")]
|
||||||
{
|
private string email;
|
||||||
get { return _lastName; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_lastName = value;
|
|
||||||
RaisePropertyChanged(nameof(LastName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Column("Email")]
|
|
||||||
public string Email
|
|
||||||
{
|
|
||||||
get { return _email; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_email = value;
|
|
||||||
RaisePropertyChanged(nameof(Email));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string FullName
|
public string FullName
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,5 +5,7 @@ public enum GamePointStatus
|
|||||||
New = 0,
|
New = 0,
|
||||||
InProgress = 1,
|
InProgress = 1,
|
||||||
Completed = 2,
|
Completed = 2,
|
||||||
Cancelled = 3
|
Cancelled = 3,
|
||||||
|
Winning = 4,
|
||||||
|
Winner = 5
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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,55 +1,27 @@
|
|||||||
using Common.Library;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
namespace GreadyPoang.EntityLayer;
|
namespace GreadyPoang.EntityLayer;
|
||||||
|
|
||||||
public class PlayerColumn : EntityBase
|
public partial class PlayerColumn : ObservableObject
|
||||||
{
|
{
|
||||||
public PlayerColumn()
|
public PlayerColumn()
|
||||||
{
|
{
|
||||||
_playerName = string.Empty;
|
PlayerName = string.Empty;
|
||||||
_values = new List<string>();
|
Values = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private int _playerId;
|
[ObservableProperty]
|
||||||
private string _playerName;
|
private int playerId;
|
||||||
private List<string> _values;
|
|
||||||
public string PlayerName
|
|
||||||
{
|
|
||||||
get { return _playerName; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_playerName = value;
|
|
||||||
RaisePropertyChanged(nameof(PlayerName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public List<string> Values
|
|
||||||
{
|
|
||||||
get { return _values; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_values = value;
|
|
||||||
RaisePropertyChanged(nameof(Values));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int PlayerId
|
[ObservableProperty]
|
||||||
{
|
private string playerName;
|
||||||
get { return _playerId; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_playerId = value;
|
|
||||||
RaisePropertyChanged(nameof(PlayerId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int _playerPoints;
|
[ObservableProperty]
|
||||||
|
private List<string> values;
|
||||||
|
|
||||||
public int PlayerPoints
|
[ObservableProperty]
|
||||||
{
|
private int playerPoints;
|
||||||
get { return _playerPoints; }
|
|
||||||
set { _playerPoints = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,128 +1,56 @@
|
|||||||
using Common.Library;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
namespace GreadyPoang.EntityLayer;
|
namespace GreadyPoang.EntityLayer;
|
||||||
|
|
||||||
public class RoundBuilderElement : EntityBase
|
public partial class RoundBuilderElement : ObservableObject
|
||||||
{
|
{
|
||||||
public RoundBuilderElement()
|
public RoundBuilderElement()
|
||||||
{
|
{
|
||||||
_participantId = 0;
|
ParticipantId = 0;
|
||||||
_participantName = string.Empty;
|
ParticipantName = string.Empty;
|
||||||
_gameRoundRegNr = 0;
|
GameRoundRegNr = 0;
|
||||||
_gameRegPoints = 0;
|
GameRegPoints = 0;
|
||||||
_status = GamePointStatus.New;
|
Status = GamePointStatus.New;
|
||||||
_gameRoundStartDate = DateTime.MinValue;
|
GameRoundStartDate = DateTime.MinValue;
|
||||||
_gameRoundId = 0;
|
GameRoundId = 0;
|
||||||
_gamePointId = 0;
|
GamePointId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _participantId;
|
[ObservableProperty]
|
||||||
private string _participantName;
|
private int participantId;
|
||||||
private int _gameRoundRegNr;
|
|
||||||
private int _gameRegPoints;
|
|
||||||
private GamePointStatus _status;
|
|
||||||
private DateTime _gameRoundStartDate;
|
|
||||||
private int _gameRoundId;
|
|
||||||
private int _gamePointId;
|
|
||||||
|
|
||||||
public int ParticipantId
|
[ObservableProperty]
|
||||||
{
|
private string participantName;
|
||||||
get { return _participantId; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_participantId = value;
|
|
||||||
RaisePropertyChanged(nameof(ParticipantId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int gameRoundRegNr;
|
||||||
|
|
||||||
public string ParticipantName
|
[ObservableProperty]
|
||||||
{
|
private int gameRegPoints;
|
||||||
get { return _participantName; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_participantName = value;
|
|
||||||
RaisePropertyChanged(nameof(ParticipantName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
[NotifyPropertyChangedFor(nameof(StatusString))]
|
||||||
|
private GamePointStatus status;
|
||||||
|
|
||||||
public int GameRoundRegNr
|
[ObservableProperty]
|
||||||
{
|
[NotifyPropertyChangedFor(nameof(GameRoundStartDateString))]
|
||||||
get { return _gameRoundRegNr; }
|
private DateTime gameRoundStartDate;
|
||||||
set
|
|
||||||
{
|
|
||||||
_gameRoundRegNr = value;
|
|
||||||
RaisePropertyChanged(nameof(GameRoundRegNr));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int gameRoundId;
|
||||||
|
|
||||||
public int GameRegPoints
|
[ObservableProperty]
|
||||||
{
|
private int gamePointId;
|
||||||
get { return _gameRegPoints; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gameRegPoints = value;
|
|
||||||
RaisePropertyChanged(nameof(GameRegPoints));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public GamePointStatus Status
|
|
||||||
{
|
|
||||||
get { return _status; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_status = value;
|
|
||||||
RaisePropertyChanged(nameof(Status));
|
|
||||||
RaisePropertyChanged(nameof(StatusString));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string StatusString
|
public string StatusString
|
||||||
{
|
{
|
||||||
get { return _status.ToString(); }
|
get { return status.ToString(); }
|
||||||
}
|
|
||||||
|
|
||||||
public DateTime GameRoundStartDate
|
|
||||||
{
|
|
||||||
get { return _gameRoundStartDate; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gameRoundStartDate = value;
|
|
||||||
RaisePropertyChanged(nameof(GameRoundStartDate));
|
|
||||||
RaisePropertyChanged(nameof(GameRoundStartDateString));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GameRoundStartDateString
|
public string GameRoundStartDateString
|
||||||
{
|
{
|
||||||
get { return _gameRoundStartDate.ToString("yyyy-MM-dd"); }
|
get { return gameRoundStartDate.ToString("yyyy-MM-dd"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GameRoundId
|
|
||||||
{
|
|
||||||
get { return _gameRoundId; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gameRoundId = value;
|
|
||||||
RaisePropertyChanged(nameof(GameRoundId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public int GamePointId
|
|
||||||
{
|
|
||||||
get { return _gamePointId; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gamePointId = value;
|
|
||||||
RaisePropertyChanged(nameof(GamePointId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,56 +1,26 @@
|
|||||||
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 DateTime _gameRoundStartDate;
|
|
||||||
private GamePointStatus _status;
|
|
||||||
private List<RoundBuilderElement> _elements;
|
|
||||||
public int GameRoundId
|
|
||||||
{
|
|
||||||
get { return _gameRoundId; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gameRoundId = value;
|
|
||||||
// No need to raise property changed for this example
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public DateTime GameRoundStartDate
|
|
||||||
{
|
|
||||||
get { return _gameRoundStartDate; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gameRoundStartDate = value;
|
|
||||||
// No need to raise property changed for this example
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public GamePointStatus Status
|
|
||||||
{
|
|
||||||
get { return _status; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_status = value;
|
|
||||||
// No need to raise property changed for this example
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RoundBuilderElement> Elements
|
[ObservableProperty]
|
||||||
{
|
private int gameRoundId;
|
||||||
get { return _elements; }
|
|
||||||
set
|
[ObservableProperty]
|
||||||
{
|
private DateTime gameRoundStartDate;
|
||||||
_elements = value;
|
|
||||||
RaisePropertyChanged(nameof(Elements));
|
[ObservableProperty]
|
||||||
// No need to raise property changed for this example
|
private GamePointStatus _status;
|
||||||
}
|
|
||||||
}
|
[ObservableProperty]
|
||||||
|
private List<RoundBuilderElement> elements;
|
||||||
}
|
}
|
||||||
|
|||||||
7
GreadyPoang.EntityLayer/HelperEntities/ScoreCell.cs
Normal file
7
GreadyPoang.EntityLayer/HelperEntities/ScoreCell.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace GreadyPoang.EntityLayer;
|
||||||
|
|
||||||
|
public class ScoreCell
|
||||||
|
{
|
||||||
|
public string Text { get; set; }
|
||||||
|
public bool IsHeader { get; set; }
|
||||||
|
}
|
||||||
9
GreadyPoang.EntityLayer/HelperEntities/ScoreColumn.cs
Normal file
9
GreadyPoang.EntityLayer/HelperEntities/ScoreColumn.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
|
namespace GreadyPoang.EntityLayer;
|
||||||
|
|
||||||
|
public class ScoreColumn
|
||||||
|
{
|
||||||
|
public string PlayerName { get; set; }
|
||||||
|
public ObservableCollection<ScoreCell> Cells { get; set; } = new();
|
||||||
|
}
|
||||||
@ -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
GreadyPoang.Services/Services/Implements/LatestPopup.cs
Normal file
6
GreadyPoang.Services/Services/Implements/LatestPopup.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace GreadyPoang.Services;
|
||||||
|
|
||||||
|
public static class LatestPopup
|
||||||
|
{
|
||||||
|
public static string valueGuid = "";
|
||||||
|
}
|
||||||
12
GreadyPoang.Services/Services/Implements/PopupEventHub.cs
Normal file
12
GreadyPoang.Services/Services/Implements/PopupEventHub.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace GreadyPoang.Services;
|
||||||
|
|
||||||
|
public class PopupEventHub : IPopupEventHub
|
||||||
|
{
|
||||||
|
public event EventHandler<PopupCloseEventArgs>? InfoPopupCloseRequested;
|
||||||
|
|
||||||
|
public void RaiseInfoPopupClose(string popupId)
|
||||||
|
{
|
||||||
|
InfoPopupCloseRequested?.Invoke(this, new PopupCloseEventArgs(popupId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
namespace GreadyPoang.Services;
|
||||||
|
|
||||||
|
public interface IPopupEventHub
|
||||||
|
{
|
||||||
|
event EventHandler<PopupCloseEventArgs>? InfoPopupCloseRequested;
|
||||||
|
|
||||||
|
void RaiseInfoPopupClose(string popupId);
|
||||||
|
|
||||||
|
}
|
||||||
11
GreadyPoang.Services/Services/PopupClosingEventArgs.cs
Normal file
11
GreadyPoang.Services/Services/PopupClosingEventArgs.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
namespace GreadyPoang.Services;
|
||||||
|
|
||||||
|
public class PopupCloseEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public string PopupId { get; }
|
||||||
|
|
||||||
|
public PopupCloseEventArgs(string popupId)
|
||||||
|
{
|
||||||
|
PopupId = popupId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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" />
|
||||||
|
|||||||
@ -0,0 +1,50 @@
|
|||||||
|
using CommunityToolkit.Maui;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using GreadyPoang.Services;
|
||||||
|
|
||||||
|
namespace GreadyPoang.ViewModelLayer;
|
||||||
|
|
||||||
|
public partial class InfoPopupViewModel : ObservableObject, IQueryAttributable
|
||||||
|
{
|
||||||
|
private readonly IPopupService _popupService;
|
||||||
|
private readonly IPopupEventHub _popupEvent;
|
||||||
|
public string PopupId { get; } = Guid.NewGuid().ToString();
|
||||||
|
|
||||||
|
public event EventHandler ClosePopupRequested;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string title;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string message;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string name;
|
||||||
|
public InfoPopupViewModel(IPopupService popupService, IPopupEventHub popupEvent)
|
||||||
|
{
|
||||||
|
_popupService = popupService;
|
||||||
|
_popupEvent = popupEvent;
|
||||||
|
LatestPopup.valueGuid = PopupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task Cancel()
|
||||||
|
{
|
||||||
|
_popupEvent.RaiseInfoPopupClose(PopupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand(CanExecute = nameof(CanSave))]
|
||||||
|
void OnSave()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CanSave() => string.IsNullOrWhiteSpace(Name) is false;
|
||||||
|
|
||||||
|
public void ApplyQueryAttributes(IDictionary<string, object> query)
|
||||||
|
{
|
||||||
|
Title = (string)query[nameof(InfoPopupViewModel.Title)];
|
||||||
|
Message = (string)query[nameof(InfoPopupViewModel.Message)];
|
||||||
|
Name = (string)query[nameof(InfoPopupViewModel.Name)];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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,16 @@
|
|||||||
using Common.Library;
|
using Common.Library;
|
||||||
|
using CommunityToolkit.Maui;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using GreadyPoang.Core;
|
||||||
using GreadyPoang.EntityLayer;
|
using GreadyPoang.EntityLayer;
|
||||||
|
using GreadyPoang.Services;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
|
|
||||||
namespace GreadyPoang.ViewModelLayer;
|
namespace GreadyPoang.ViewModelLayer;
|
||||||
|
|
||||||
public class ParticipantViewModel : ViewModelBase
|
public partial class ParticipantViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
#region Constructors
|
#region Constructors
|
||||||
public ParticipantViewModel() : base()
|
public ParticipantViewModel() : base()
|
||||||
@ -13,49 +18,68 @@ public class ParticipantViewModel : ViewModelBase
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ParticipantViewModel(IRepository<Participant> repo, IMethodSharingService<Participant> sharingService) : base()
|
public ParticipantViewModel(
|
||||||
|
IRepository<Participant> repo,
|
||||||
|
IMethodSharingService<Participant> sharingService,
|
||||||
|
IPopupService popupService,
|
||||||
|
IPopupEventHub popupEvent
|
||||||
|
) : base()
|
||||||
{
|
{
|
||||||
_Repository = repo;
|
_Repository = repo;
|
||||||
_sharingService = sharingService;
|
_sharingService = sharingService;
|
||||||
|
_popupService = popupService;
|
||||||
|
_popupEvent = popupEvent;
|
||||||
|
ParticipantObject = new Participant();
|
||||||
|
ParticipantList = new ObservableCollection<Participant>();
|
||||||
|
IsSaveCommandEnabled = true;
|
||||||
|
PopupVisad = false;
|
||||||
|
_popupEvent.InfoPopupCloseRequested += infoPopupViewModel_ClosePopupRequested;
|
||||||
}
|
}
|
||||||
|
|
||||||
#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
|
private readonly IPopupService _popupService;
|
||||||
|
private readonly IPopupEventHub _popupEvent;
|
||||||
#region public Properties
|
private readonly InfoPopupViewModel _infoPopupViewModel;
|
||||||
|
private string _activePopupId;
|
||||||
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
|
#endregion
|
||||||
|
|
||||||
|
public bool PopupVisad { get; set; }
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool isSaveCommandEnabled;
|
||||||
|
|
||||||
#region Get Method
|
#region Get Method
|
||||||
public ObservableCollection<Participant> Get()
|
public ObservableCollection<Participant> Get()
|
||||||
{
|
{
|
||||||
ParticipantList = _sharingService.Get();
|
ParticipantList = _sharingService.Get();
|
||||||
|
|
||||||
|
if (!PopupVisad)
|
||||||
|
{
|
||||||
|
var queryAttributes = new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
[nameof(InfoPopupViewModel.Title)] = "Deltagar bildens infopopup",
|
||||||
|
[nameof(InfoPopupViewModel.Message)] = "Deltagare laddade",
|
||||||
|
[nameof(InfoPopupViewModel.Name)] = " ",
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
_popupService.ShowPopup<InfoPopupViewModel>(
|
||||||
|
Shell.Current,
|
||||||
|
options: PopupOptions.Empty,
|
||||||
|
shellParameters: queryAttributes);
|
||||||
|
|
||||||
|
_activePopupId = LatestPopup.valueGuid;
|
||||||
|
}
|
||||||
|
|
||||||
return ParticipantList;
|
return ParticipantList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,20 +101,62 @@ public class ParticipantViewModel : ViewModelBase
|
|||||||
|
|
||||||
return ParticipantObject;
|
return ParticipantObject;
|
||||||
}
|
}
|
||||||
public virtual bool Save()
|
|
||||||
{
|
|
||||||
if (_Repository == null || ParticipantObject == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var tmpTask = _Repository.Save(ParticipantObject);
|
|
||||||
int tmp = tmpTask.GetAwaiter().GetResult();
|
|
||||||
if (tmp != -1)
|
|
||||||
{
|
|
||||||
ParticipantObject = new Participant();
|
|
||||||
this.Get();
|
|
||||||
}
|
|
||||||
return tmp != -1;
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
[RelayCommand(CanExecute = nameof(IsSaveCommandEnabled))]
|
||||||
|
private async Task Save()
|
||||||
|
{
|
||||||
|
await RunAsyncCommand(async () =>
|
||||||
|
{
|
||||||
|
if (_Repository == null || ParticipantObject == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await Task.Delay(3600); // Simulerar en fördröjning för att visa laddningsindikatorn
|
||||||
|
var tmpTask = _Repository.Save(ParticipantObject);
|
||||||
|
int tmp = await tmpTask;
|
||||||
|
if (tmp != -1)
|
||||||
|
{
|
||||||
|
ParticipantObject = new Participant();
|
||||||
|
this.Get();
|
||||||
|
await Shell.Current.GoToAsync("..");
|
||||||
|
}
|
||||||
|
}, loadingMessage: "Sparar deltagare...", errorMessage: "Fel vid sparande av deltagare");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void DeleteAsync(Participant pp)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Valt från ViewModel: {pp.FullName}");
|
||||||
|
if (_Repository == null || pp == null || pp.ParticipantId <= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var tmpTask = _Repository.Delete(pp);
|
||||||
|
this.Get();
|
||||||
|
Shell.Current.GoToAsync("..");
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task LoadDataAsync()
|
||||||
|
{
|
||||||
|
await RunAsyncCommand(async () =>
|
||||||
|
{
|
||||||
|
await Task.Delay(1500); // Simulerar laddning
|
||||||
|
Console.WriteLine("Data laddad!");
|
||||||
|
}, loadingMessage: "Laddar data...");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void infoPopupViewModel_ClosePopupRequested(object? sender, PopupCloseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.PopupId != _activePopupId)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PopupVisad = true;
|
||||||
|
await _popupService.ClosePopupAsync(Shell.Current);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,16 +1,21 @@
|
|||||||
using Common.Library;
|
using Common.Library;
|
||||||
|
using CommunityToolkit.Maui;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using GreadyPoang.DataLayer;
|
using GreadyPoang.DataLayer;
|
||||||
using GreadyPoang.EntityLayer;
|
using GreadyPoang.EntityLayer;
|
||||||
using GreadyPoang.Services;
|
using GreadyPoang.Services;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace GreadyPoang.ViewModelLayer;
|
namespace GreadyPoang.ViewModelLayer;
|
||||||
|
|
||||||
public class RoundRunningViewModel : ViewModelBase
|
public partial class RoundRunningViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
|
|
||||||
public event EventHandler RebuildRequested;
|
public event EventHandler RebuildRequested;
|
||||||
|
public ICommand OnLoadedCommand { get; }
|
||||||
|
|
||||||
public RoundRunningViewModel() : base()
|
public RoundRunningViewModel() : base()
|
||||||
{
|
{
|
||||||
@ -22,7 +27,9 @@ public class RoundRunningViewModel : ViewModelBase
|
|||||||
IRepository<GamePoint> pointsRepo,
|
IRepository<GamePoint> pointsRepo,
|
||||||
IMethodSharingService<Participant> sharingService,
|
IMethodSharingService<Participant> sharingService,
|
||||||
ICombinedRepository combined,
|
ICombinedRepository combined,
|
||||||
IObjectMessageService objectMessage
|
IObjectMessageService objectMessage,
|
||||||
|
IPopupService popupService,
|
||||||
|
IPopupEventHub popupEvent
|
||||||
) : base()
|
) : base()
|
||||||
{
|
{
|
||||||
_roundsRepo = roundsRepo;
|
_roundsRepo = roundsRepo;
|
||||||
@ -30,8 +37,14 @@ public class RoundRunningViewModel : ViewModelBase
|
|||||||
_sharingService = sharingService;
|
_sharingService = sharingService;
|
||||||
_combined = combined;
|
_combined = combined;
|
||||||
_objectMessage = objectMessage;
|
_objectMessage = objectMessage;
|
||||||
_roundElements = new ObservableCollection<RoundBuilderElement>();
|
_popupService = popupService;
|
||||||
_builderObject = new();
|
_popupEvent = popupEvent;
|
||||||
|
RoundElements = new ObservableCollection<RoundBuilderElement>();
|
||||||
|
BuilderObject = new();
|
||||||
|
_popupEvent.InfoPopupCloseRequested += infoPopupViewModel_ClosePopupRequested;
|
||||||
|
//PopupVisad = false;
|
||||||
|
OnLoadedCommand = new AsyncRelayCommand(OnLoadedAsync, () => true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly IRepository<GameRound>? _roundsRepo;
|
private readonly IRepository<GameRound>? _roundsRepo;
|
||||||
@ -39,53 +52,30 @@ public class RoundRunningViewModel : ViewModelBase
|
|||||||
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 readonly IPopupService _popupService;
|
||||||
|
private readonly IPopupEventHub _popupEvent;
|
||||||
|
|
||||||
private ObservableCollection<RoundBuilderGroup> _GameRoundList = new();
|
[ObservableProperty]
|
||||||
private ObservableCollection<Participant> _ParticipantList = new();
|
private ObservableCollection<RoundBuilderElement> roundElements;
|
||||||
private ObservableCollection<RoundBuilderElement> _roundElements;
|
[ObservableProperty]
|
||||||
private Collection<PlayerColumn> _playerColumns;
|
private Collection<PlayerColumn> playerColumns;
|
||||||
private RoundBuilderElement _builderObject;
|
[ObservableProperty]
|
||||||
|
private RoundBuilderElement builderObject;
|
||||||
|
public ObservableCollection<ScoreColumn> ScoreColumns { get; } = new ObservableCollection<ScoreColumn>();
|
||||||
|
|
||||||
public void TriggerRebuild()
|
|
||||||
|
|
||||||
|
private string _activePopupId;
|
||||||
|
|
||||||
|
//public bool PopupVisad { get; set; }
|
||||||
|
|
||||||
|
private async Task OnLoadedAsync()
|
||||||
{
|
{
|
||||||
// Trigga eventet
|
await Get();
|
||||||
RebuildRequested?.Invoke(this, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObservableCollection<RoundBuilderElement> RoundElements
|
public async Task Get()
|
||||||
{
|
{
|
||||||
get { return _roundElements; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_roundElements = value;
|
|
||||||
RaisePropertyChanged(nameof(RoundElements));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<PlayerColumn> PlayerColumns
|
|
||||||
{
|
|
||||||
get { return _playerColumns; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_playerColumns = value;
|
|
||||||
RaisePropertyChanged(nameof(PlayerColumns));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public RoundBuilderElement BuilderObject
|
|
||||||
{
|
|
||||||
get { return _builderObject; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_builderObject = value;
|
|
||||||
RaisePropertyChanged(nameof(BuilderObject));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public ObservableCollection<RoundBuilderElement> Get()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
if (_objectMessage.CurrentGroup != null)
|
if (_objectMessage.CurrentGroup != null)
|
||||||
{
|
{
|
||||||
@ -97,29 +87,20 @@ 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
|
|
||||||
var nxt = nextPlayerElement();
|
|
||||||
|
|
||||||
// Aktuell spelare sätts som BuilderObject
|
|
||||||
BuilderObject.ParticipantName = _objectMessage.CurrentGroup.Elements[nxt].ParticipantName;
|
|
||||||
BuilderObject.GameRoundId = _objectMessage.CurrentGroup.GameRoundId;
|
|
||||||
BuilderObject.ParticipantId = _objectMessage.CurrentGroup.Elements[nxt].ParticipantId;
|
|
||||||
BuilderObject.Status = _objectMessage.CurrentGroup.Status;
|
BuilderObject.Status = _objectMessage.CurrentGroup.Status;
|
||||||
|
|
||||||
// Alla poängposter från samtliga spelare i rundan samlas ihop och fördelas per deltagare
|
UpdateAndShow();
|
||||||
var localElements = _combined.roundBuilderElementsTotalById(_objectMessage.CurrentGroup.GameRoundId);
|
|
||||||
|
|
||||||
FillupResultTable(localElements);
|
|
||||||
TriggerRebuild();
|
|
||||||
}
|
}
|
||||||
return RoundElements;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void StoreAndHandlePoints()
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void StoreAndHandlePointsAsync()
|
||||||
{
|
{
|
||||||
var game = _roundsRepo.Get(BuilderObject.GameRoundId).GetAwaiter().GetResult();
|
var game = _roundsRepo.Get(BuilderObject.GameRoundId).GetAwaiter().GetResult();
|
||||||
var regNr = RoundElements.Count > 0 ? RoundElements.Max(e => e.GameRoundRegNr) + 1 : 1;
|
var regNr = RoundElements.Count > 0 ? RoundElements.Max(e => e.GameRoundRegNr) + 1 : 1;
|
||||||
@ -153,20 +134,10 @@ public class RoundRunningViewModel : ViewModelBase
|
|||||||
RoundElements.Add(item);
|
RoundElements.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uppdatera spelaren som skall spela nästa
|
|
||||||
var nxt = nextPlayerElement();
|
|
||||||
BuilderObject.GameRegPoints = 0;
|
BuilderObject.GameRegPoints = 0;
|
||||||
BuilderObject.ParticipantName = RoundElements[nxt].ParticipantName;
|
UpdateAndShow();
|
||||||
BuilderObject.ParticipantId = RoundElements[nxt].ParticipantId;
|
Shell.Current.GoToAsync("..").GetAwaiter().GetResult();
|
||||||
BuilderObject.GameRoundId = RoundElements[0].GameRoundId;
|
|
||||||
|
|
||||||
var localElements = _combined.roundBuilderElementsTotalById(BuilderObject.GameRoundId);
|
|
||||||
FillupResultTable(localElements);
|
|
||||||
foreach (var col in _playerColumns)
|
|
||||||
{
|
|
||||||
RoundElements.FirstOrDefault(e => e.ParticipantId == col.PlayerId).GameRegPoints = col.PlayerPoints;
|
|
||||||
}
|
|
||||||
TriggerRebuild();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int nextPlayerElement()
|
private int nextPlayerElement()
|
||||||
@ -181,17 +152,76 @@ public class RoundRunningViewModel : ViewModelBase
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateAndShow()
|
||||||
|
{
|
||||||
|
// Räkna ut vem som är nästa spelare
|
||||||
|
var nxt = nextPlayerElement();
|
||||||
|
|
||||||
|
// Aktuell spelare sätts som BuilderObject
|
||||||
|
BuilderObject.ParticipantName = _objectMessage.CurrentGroup.Elements[nxt].ParticipantName;
|
||||||
|
BuilderObject.ParticipantId = _objectMessage.CurrentGroup.Elements[nxt].ParticipantId;
|
||||||
|
BuilderObject.GameRoundId = _objectMessage.CurrentGroup.GameRoundId;
|
||||||
|
|
||||||
|
|
||||||
|
// Alla poängposter från samtliga spelare i rundan samlas ihop och fördelas per deltagare
|
||||||
|
var localElements = _combined.roundBuilderElementsTotalById(_objectMessage.CurrentGroup.GameRoundId);
|
||||||
|
|
||||||
|
FillupResultTable(localElements);
|
||||||
|
// Fix for CS8602: Add null check before dereferencing FirstOrDefault result
|
||||||
|
foreach (var col in PlayerColumns)
|
||||||
|
{
|
||||||
|
var roundElement = RoundElements.FirstOrDefault(e => e.ParticipantId == col.PlayerId);
|
||||||
|
if (roundElement != null)
|
||||||
|
{
|
||||||
|
roundElement.GameRegPoints = col.PlayerPoints;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Fix for MVVMTK0034: Use the generated property 'PlayerColumns' instead of the backing field 'playerColumns'
|
||||||
|
BuildScore(PlayerColumns);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Show_a_Popup(string ppName, string ppTitle, string ppMessage)
|
||||||
|
{
|
||||||
|
//if (!PopupVisad)
|
||||||
|
//{
|
||||||
|
var queryAttributes = new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
[nameof(InfoPopupViewModel.Title)] = ppTitle,
|
||||||
|
[nameof(InfoPopupViewModel.Message)] = ppMessage,
|
||||||
|
[nameof(InfoPopupViewModel.Name)] = ppName,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
_popupService.ShowPopup<InfoPopupViewModel>(
|
||||||
|
Shell.Current,
|
||||||
|
options: PopupOptions.Empty,
|
||||||
|
shellParameters: queryAttributes);
|
||||||
|
|
||||||
|
_activePopupId = LatestPopup.valueGuid;
|
||||||
|
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void infoPopupViewModel_ClosePopupRequested(object? sender, PopupCloseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.PopupId != _activePopupId)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//PopupVisad = true;
|
||||||
|
await _popupService.ClosePopupAsync(Shell.Current);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
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))
|
||||||
@ -199,10 +229,12 @@ public class RoundRunningViewModel : ViewModelBase
|
|||||||
{
|
{
|
||||||
PlayerColumn player = new PlayerColumn();
|
PlayerColumn player = new PlayerColumn();
|
||||||
|
|
||||||
|
var regMax = elements.Max(e => e.GameRoundRegNr);
|
||||||
|
var existingWinning = elements.FirstOrDefault(e => e.Status == GamePointStatus.Winning);
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
player = new PlayerColumn
|
player = new PlayerColumn
|
||||||
@ -216,13 +248,17 @@ public class RoundRunningViewModel : ViewModelBase
|
|||||||
if (element.GameRegPoints > 0)
|
if (element.GameRegPoints > 0)
|
||||||
{
|
{
|
||||||
player.Values.Add(element.GameRegPoints.ToString());
|
player.Values.Add(element.GameRegPoints.ToString());
|
||||||
|
var playerPointsOld = player.PlayerPoints;
|
||||||
player.PlayerPoints += element.GameRegPoints;
|
player.PlayerPoints += element.GameRegPoints;
|
||||||
|
if (player.PlayerPoints > 10000)
|
||||||
|
{
|
||||||
|
HandlePlayerReachedWinningThreshold(player, regMax, element, playerPointsOld, existingWinning);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//oldPart = element.ParticipantId;
|
|
||||||
|
|
||||||
if (!_playerColumns.Contains(player))
|
if (!PlayerColumns.Contains(player))
|
||||||
{
|
{
|
||||||
_playerColumns.Add(player);
|
PlayerColumns.Add(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,7 +270,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++)
|
||||||
@ -242,11 +280,91 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HandlePlayerReachedWinningThreshold(
|
||||||
|
PlayerColumn player,
|
||||||
|
int regMax,
|
||||||
|
RoundBuilderElement element,
|
||||||
|
int playerPointsOld,
|
||||||
|
RoundBuilderElement existingWinning
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
var nextPlayer = RoundElements[AfterNext()].ParticipantName;
|
||||||
|
Debug.WriteLine($"Spelare {nextPlayer} samma som {player.PlayerName} ???.");
|
||||||
|
if (existingWinning != null && existingWinning.ParticipantId != player.PlayerId)
|
||||||
|
{
|
||||||
|
// Det finns redan en vinnare, sätt dennes status tillbaka till InProgress
|
||||||
|
existingWinning.Status = GamePointStatus.InProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Om det redan finns en vinnare, sätt dennes status tillbaka till InProgress, kanske
|
||||||
|
|
||||||
|
var winner = RoundElements.FirstOrDefault(e => e.ParticipantId == player.PlayerId);
|
||||||
|
var oldStatus = winner.Status;
|
||||||
|
winner.Status = GamePointStatus.Winning;
|
||||||
|
if (playerPointsOld < 10000 && oldStatus != winner.Status && regMax == element.GameRoundRegNr)
|
||||||
|
{
|
||||||
|
//PopupVisad = false;
|
||||||
|
Show_a_Popup(
|
||||||
|
player.PlayerName,
|
||||||
|
"Se upp för denne spelare !",
|
||||||
|
$"Du har nått en poängnivå över 10000 ({player.PlayerPoints})\r" +
|
||||||
|
$"Alla övriga får nu en chans att överträffa\r" +
|
||||||
|
$"om någon kommer till samma poäng som\r" +
|
||||||
|
$"{player.PlayerName}\r" +
|
||||||
|
$"får hen försvara sig med nytt kast\r" +
|
||||||
|
$"Om kastet inte blir godkänt (ger poäng)\r" +
|
||||||
|
$"Vinner den upphinnande spelaren"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int AfterNext()
|
||||||
|
{
|
||||||
|
var comingUp = nextPlayerElement();
|
||||||
|
if (RoundElements.Count - 1 == comingUp)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return comingUp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void BuildScore(IEnumerable<PlayerColumn> columns)
|
||||||
|
{
|
||||||
|
ScoreColumns.Clear();
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var column in columns)
|
||||||
|
{
|
||||||
|
var scoreColumn = new ScoreColumn
|
||||||
|
{
|
||||||
|
PlayerName = column.PlayerName
|
||||||
|
};
|
||||||
|
|
||||||
|
scoreColumn.Cells.Add(new ScoreCell
|
||||||
|
{
|
||||||
|
Text = column.PlayerName,
|
||||||
|
IsHeader = true
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (var value in System.Linq.Enumerable.Reverse(column.Values))
|
||||||
|
{
|
||||||
|
scoreColumn.Cells.Add(new ScoreCell
|
||||||
|
{
|
||||||
|
Text = value,
|
||||||
|
IsHeader = false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ScoreColumns.Add(scoreColumn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
using Common.Library;
|
using Common.Library;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using GreadyPoang.DataLayer;
|
using GreadyPoang.DataLayer;
|
||||||
using GreadyPoang.EntityLayer;
|
using GreadyPoang.EntityLayer;
|
||||||
using GreadyPoang.Services;
|
using GreadyPoang.Services;
|
||||||
@ -7,7 +9,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 +29,44 @@ 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;
|
|
||||||
|
|
||||||
public ObservableCollection<RoundBuilderElement> RoundElements
|
[ObservableProperty]
|
||||||
|
private Participant selectedItem;
|
||||||
|
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
|
[ObservableProperty]
|
||||||
{
|
private ObservableCollection<RoundBuilderGroup> gameRoundList = new();
|
||||||
if (_selectedItem != value)
|
|
||||||
{
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<Participant> participantList = new();
|
||||||
|
|
||||||
_selectedItem = value;
|
|
||||||
RaisePropertyChanged(nameof(SelectedItem));
|
|
||||||
OnItemSelected(value); // Metod som triggas vid val
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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,41 +104,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()
|
||||||
@ -205,7 +170,9 @@ public class RoundStartingViewModel : ViewModelBase
|
|||||||
|
|
||||||
return GameRoundObject;
|
return GameRoundObject;
|
||||||
}
|
}
|
||||||
public virtual bool Save()
|
|
||||||
|
[RelayCommand]
|
||||||
|
public async Task<bool> SaveAsync()
|
||||||
{
|
{
|
||||||
if (_roundsRepo == null || GameRoundObject == null)
|
if (_roundsRepo == null || GameRoundObject == null)
|
||||||
{
|
{
|
||||||
@ -218,11 +185,13 @@ public class RoundStartingViewModel : ViewModelBase
|
|||||||
GameRoundObject = new GameRound();
|
GameRoundObject = new GameRound();
|
||||||
RoundElements.Clear();
|
RoundElements.Clear();
|
||||||
this.Get();
|
this.Get();
|
||||||
|
await Shell.Current.GoToAsync("..");
|
||||||
}
|
}
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Rensa()
|
[RelayCommand]
|
||||||
|
private async Task RensaAsync()
|
||||||
{
|
{
|
||||||
foreach (var element in RoundElements)
|
foreach (var element in RoundElements)
|
||||||
{
|
{
|
||||||
@ -230,22 +199,29 @@ public class RoundStartingViewModel : ViewModelBase
|
|||||||
}
|
}
|
||||||
_roundsRepo?.DeleteById(GameRoundObject?.GameRoundId ?? 0);
|
_roundsRepo?.DeleteById(GameRoundObject?.GameRoundId ?? 0);
|
||||||
RoundElements.Clear();
|
RoundElements.Clear();
|
||||||
|
await Shell.Current.GoToAsync("..");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RoundSelected(RoundBuilderElement element)
|
[RelayCommand]
|
||||||
|
public async Task RoundSelected(RoundBuilderElement element)
|
||||||
{
|
{
|
||||||
var rbGroup = GameRoundList.FirstOrDefault(g => g.GameRoundId == element.GameRoundId);
|
var rbGroup = GameRoundList.FirstOrDefault(g => g.GameRoundId == element.GameRoundId);
|
||||||
Debug.WriteLine($"Du valde raden med Runda {element.GameRoundId} och spelare: {element.ParticipantName}");
|
Debug.WriteLine($"Du valde raden med Runda {element.GameRoundId} och spelare: {element.ParticipantName}");
|
||||||
if (rbGroup != null)
|
if (rbGroup != null)
|
||||||
{
|
{
|
||||||
_objectMessage.CurrentGroup = rbGroup;
|
_objectMessage.CurrentGroup = rbGroup;
|
||||||
Shell.Current.GoToAsync("//RoundRunningView");
|
//await Shell.Current.GoToAsync("//RoundRunningView");
|
||||||
|
await Shell.Current.GoToAsync("//RoundRunningView");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SelectNewlyAddedParticipant(RoundBuilderElement roundBuilder)
|
[RelayCommand]
|
||||||
|
public async Task<bool> SelectNewlyAddedParticipant(RoundBuilderElement roundBuilder)
|
||||||
{
|
{
|
||||||
|
bool goneOk = false;
|
||||||
Debug.WriteLine($"Du valde raden med Runda {roundBuilder.GameRoundId} och spelare: {roundBuilder.ParticipantName}");
|
Debug.WriteLine($"Du valde raden med Runda {roundBuilder.GameRoundId} och spelare: {roundBuilder.ParticipantName}");
|
||||||
|
goneOk = true;
|
||||||
|
return goneOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -1,66 +0,0 @@
|
|||||||
using Common.Library;
|
|
||||||
using GreadyPoang.EntityLayer;
|
|
||||||
using GreadyPoang.ViewModelLayer;
|
|
||||||
using System.Windows.Input;
|
|
||||||
|
|
||||||
namespace GreadyPoang.CommandClasses;
|
|
||||||
|
|
||||||
public class ParticipantViewModelCommands : ParticipantViewModel
|
|
||||||
{
|
|
||||||
#region constructors
|
|
||||||
public ParticipantViewModelCommands() : base()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
public ParticipantViewModelCommands(IRepository<Participant> repo, IMethodSharingService<Participant> sharingService) : base(repo, sharingService)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Private Variables
|
|
||||||
private bool _IsSaveCommandEnabled = true;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Public Properties
|
|
||||||
public bool IsSaveCommandEnabled
|
|
||||||
{
|
|
||||||
get { return _IsSaveCommandEnabled; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_IsSaveCommandEnabled = value;
|
|
||||||
RaisePropertyChanged(nameof(IsSaveCommandEnabled));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Commands
|
|
||||||
public ICommand SaveCommand { get; private set; }
|
|
||||||
public ICommand EditCommand { get; private set; }
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Init Method
|
|
||||||
public override void Init()
|
|
||||||
{
|
|
||||||
base.Init();
|
|
||||||
SaveCommand = new Command(async () => SaveAsync(), () => IsSaveCommandEnabled);
|
|
||||||
EditCommand = new Command<int>(async (id) => await EditAsync(id), (id) => id > 0);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
protected async Task EditAsync(int id)
|
|
||||||
{
|
|
||||||
await Shell.Current.GoToAsync($"{nameof(Views.ParticipantListView)}?id={id}");
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<bool> SaveAsync()
|
|
||||||
{
|
|
||||||
var ret = base.Save();
|
|
||||||
if (ret)
|
|
||||||
{
|
|
||||||
await Shell.Current.GoToAsync("..");
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
using Common.Library;
|
|
||||||
using GreadyPoang.DataLayer;
|
|
||||||
using GreadyPoang.EntityLayer;
|
|
||||||
using GreadyPoang.Services;
|
|
||||||
using GreadyPoang.ViewModelLayer;
|
|
||||||
using System.Windows.Input;
|
|
||||||
|
|
||||||
namespace GreadyPoang.CommandClasses;
|
|
||||||
|
|
||||||
public class RoundRunningViewModelCommands : RoundRunningViewModel
|
|
||||||
{
|
|
||||||
public RoundRunningViewModelCommands() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public RoundRunningViewModelCommands(
|
|
||||||
IRepository<GameRound> roundsRepo,
|
|
||||||
IRepository<GamePoint> pointsRepo,
|
|
||||||
IMethodSharingService<Participant> sharingService,
|
|
||||||
ICombinedRepository combined,
|
|
||||||
IObjectMessageService objectMessage)
|
|
||||||
: base(roundsRepo,
|
|
||||||
pointsRepo,
|
|
||||||
sharingService,
|
|
||||||
combined,
|
|
||||||
objectMessage)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Commands
|
|
||||||
public ICommand SaveCommand { get; private set; }
|
|
||||||
public ICommand EditCommand { get; private set; }
|
|
||||||
public ICommand RensaCommand { get; private set; }
|
|
||||||
public ICommand ElementTappedCommand { get; private set; }
|
|
||||||
public ICommand ParticipantTappedCommand { get; private set; }
|
|
||||||
public ICommand StoreAndHandlePointsCommand { get; private set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public override void Init()
|
|
||||||
{
|
|
||||||
base.Init();
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
base.StoreAndHandlePoints();
|
|
||||||
await Shell.Current.GoToAsync("..");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,107 +0,0 @@
|
|||||||
using Common.Library;
|
|
||||||
using GreadyPoang.DataLayer;
|
|
||||||
using GreadyPoang.EntityLayer;
|
|
||||||
using GreadyPoang.Services;
|
|
||||||
using GreadyPoang.ViewModelLayer;
|
|
||||||
using System.Windows.Input;
|
|
||||||
|
|
||||||
namespace GreadyPoang.CommandClasses;
|
|
||||||
|
|
||||||
public class RoundStartingViewModelCommands : RoundStartingViewModel
|
|
||||||
{
|
|
||||||
public RoundStartingViewModelCommands() : base()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
public RoundStartingViewModelCommands(
|
|
||||||
IRepository<GameRound> roundsRepo,
|
|
||||||
IRepository<GamePoint> pointsRepo,
|
|
||||||
IMethodSharingService<Participant> sharingService,
|
|
||||||
ICombinedRepository combined,
|
|
||||||
IObjectMessageService objectMessage)
|
|
||||||
: base(roundsRepo,
|
|
||||||
pointsRepo,
|
|
||||||
sharingService,
|
|
||||||
combined,
|
|
||||||
objectMessage)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Private Variables
|
|
||||||
private bool _IsSaveCommandEnabled = true;
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Public Properties
|
|
||||||
public bool IsSaveCommandEnabled
|
|
||||||
{
|
|
||||||
get { return _IsSaveCommandEnabled; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_IsSaveCommandEnabled = value;
|
|
||||||
RaisePropertyChanged(nameof(IsSaveCommandEnabled));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Commands
|
|
||||||
public ICommand SaveCommand { get; private set; }
|
|
||||||
public ICommand EditCommand { get; private set; }
|
|
||||||
public ICommand RensaCommand { get; private set; }
|
|
||||||
public ICommand ElementTappedCommand { get; private set; }
|
|
||||||
public ICommand ParticipantTappedCommand { get; private set; }
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Init Method
|
|
||||||
public override void Init()
|
|
||||||
{
|
|
||||||
base.Init();
|
|
||||||
SaveCommand = new Command(async () => SaveAsync(), () => IsSaveCommandEnabled);
|
|
||||||
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 RensaAsync()
|
|
||||||
{
|
|
||||||
base.Rensa();
|
|
||||||
await Shell.Current.GoToAsync("..");
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
protected async Task EditAsync(int id)
|
|
||||||
{
|
|
||||||
await Shell.Current.GoToAsync($"{nameof(Views.RoundStartingView)}?id={id}");
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<bool> SaveAsync()
|
|
||||||
{
|
|
||||||
var ret = base.Save();
|
|
||||||
if (ret)
|
|
||||||
{
|
|
||||||
await Shell.Current.GoToAsync("..");
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<bool> RoundSelected(RoundBuilderElement element)
|
|
||||||
{
|
|
||||||
bool goneOk = false;
|
|
||||||
base.RoundSelected(element);
|
|
||||||
goneOk = true;
|
|
||||||
return goneOk;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<bool> SelectNewlyAddedParticipant(RoundBuilderElement roundBuilder)
|
|
||||||
{
|
|
||||||
bool goneOk = false;
|
|
||||||
base.SelectNewlyAddedParticipant(roundBuilder);
|
|
||||||
goneOk = true;
|
|
||||||
return goneOk;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -60,6 +60,16 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Remove="Views\RoundRunningViewOld.xaml.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<MauiXaml Remove="Views\RoundRunningViewOld.xaml" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommunityToolkit.Maui" Version="12.2.0" />
|
||||||
|
<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" />
|
||||||
@ -75,6 +85,9 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Update="Popups\InfoPopup.xaml.cs">
|
||||||
|
<DependentUpon>InfoPopup.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Views\ParticipantListView.xaml.cs">
|
<Compile Update="Views\ParticipantListView.xaml.cs">
|
||||||
<DependentUpon>ParticipantListView.xaml</DependentUpon>
|
<DependentUpon>ParticipantListView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -87,6 +100,9 @@
|
|||||||
<MauiXaml Update="ViewsPartial\HeaderView.xaml">
|
<MauiXaml Update="ViewsPartial\HeaderView.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</MauiXaml>
|
</MauiXaml>
|
||||||
|
<MauiXaml Update="Popups\InfoPopup.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</MauiXaml>
|
||||||
<MauiXaml Update="Views\ParticipantListView.xaml">
|
<MauiXaml Update="Views\ParticipantListView.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</MauiXaml>
|
</MauiXaml>
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
using Common.Library;
|
using Common.Library;
|
||||||
using GreadyPoang.CommandClasses;
|
using CommunityToolkit.Maui;
|
||||||
using GreadyPoang.DataLayer;
|
using GreadyPoang.DataLayer;
|
||||||
using GreadyPoang.DataLayer.Database;
|
using GreadyPoang.DataLayer.Database;
|
||||||
using GreadyPoang.EntityLayer;
|
using GreadyPoang.EntityLayer;
|
||||||
|
using GreadyPoang.Popups;
|
||||||
using GreadyPoang.Services;
|
using GreadyPoang.Services;
|
||||||
using GreadyPoang.ViewModelLayer;
|
using GreadyPoang.ViewModelLayer;
|
||||||
using GreadyPoang.Views;
|
using GreadyPoang.Views;
|
||||||
@ -19,6 +20,8 @@ public static class MauiProgram
|
|||||||
|
|
||||||
builder
|
builder
|
||||||
.UseMauiApp<App>()
|
.UseMauiApp<App>()
|
||||||
|
.UseMauiCommunityToolkit(options =>
|
||||||
|
options.SetShouldEnableSnackbarOnWindows(true))
|
||||||
.ConfigureFonts(fonts =>
|
.ConfigureFonts(fonts =>
|
||||||
{
|
{
|
||||||
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
|
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
|
||||||
@ -30,33 +33,36 @@ public static class MauiProgram
|
|||||||
builder.Services.AddDbContext<DataContext>(options =>
|
builder.Services.AddDbContext<DataContext>(options =>
|
||||||
{
|
{
|
||||||
var MauiDataPath = FileSystem.Current.AppDataDirectory;
|
var MauiDataPath = FileSystem.Current.AppDataDirectory;
|
||||||
if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "MauiDataPath_GreadyPoang.txt"))) ;
|
//if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "MauiDataPath_GreadyPoang.txt"))) ;
|
||||||
{
|
//{
|
||||||
File.WriteAllText(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "MauiDataPath_GreadyPoang.txt"), MauiDataPath);
|
// File.WriteAllText(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "MauiDataPath_GreadyPoang.txt"), MauiDataPath);
|
||||||
}
|
//}
|
||||||
var dbPath = Path.Combine(MauiDataPath, "PoangDB.db");
|
var dbPath = Path.Combine(MauiDataPath, "PoangDB.db");
|
||||||
options.UseSqlite($"Data Source={dbPath}");
|
options.UseSqlite($"Data Source={dbPath}");
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.Services.AddScoped<IRepository<Participant>, ParticipantRepository>();
|
builder.Services.AddScoped<IRepository<Participant>, ParticipantRepository>();
|
||||||
builder.Services.AddScoped<ParticipantViewModelCommands>();
|
builder.Services.AddScoped<IMethodSharingService<Participant>, MethodSharingService>();
|
||||||
|
|
||||||
|
builder.Services.AddScoped<ParticipantViewModel>();
|
||||||
builder.Services.AddScoped<ParticipantListView>();
|
builder.Services.AddScoped<ParticipantListView>();
|
||||||
|
|
||||||
builder.Services.AddScoped<IRepository<GameRound>, GameRoundRepository>();
|
builder.Services.AddScoped<IRepository<GameRound>, GameRoundRepository>();
|
||||||
builder.Services.AddScoped<RoundStartingViewModelCommands>();
|
|
||||||
|
builder.Services.AddScoped<RoundStartingViewModel>();
|
||||||
builder.Services.AddScoped<RoundStartingView>();
|
builder.Services.AddScoped<RoundStartingView>();
|
||||||
|
|
||||||
builder.Services.AddSingleton<IObjectMessageService, ObjectMessageService>();
|
|
||||||
|
|
||||||
builder.Services.AddScoped<RoundRunningViewModelCommands>();
|
|
||||||
builder.Services.AddScoped<RoundRunningView>();
|
|
||||||
|
|
||||||
builder.Services.AddScoped<IRepository<GamePoint>, GamePointRepository>();
|
builder.Services.AddScoped<IRepository<GamePoint>, GamePointRepository>();
|
||||||
|
|
||||||
|
builder.Services.AddScoped<RoundRunningViewModel>();
|
||||||
builder.Services.AddScoped<IMethodSharingService<Participant>, MethodSharingService>();
|
builder.Services.AddScoped<RoundRunningView>();
|
||||||
|
|
||||||
builder.Services.AddScoped<ICombinedRepository, CombinedRepository>();
|
builder.Services.AddScoped<ICombinedRepository, CombinedRepository>();
|
||||||
|
builder.Services.AddSingleton<IObjectMessageService, ObjectMessageService>();
|
||||||
|
|
||||||
|
builder.Services.AddTransientPopup<InfoPopup, InfoPopupViewModel>();
|
||||||
|
builder.Services.AddSingleton<IPopupEventHub, PopupEventHub>();
|
||||||
|
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
builder.Logging.AddDebug();
|
builder.Logging.AddDebug();
|
||||||
|
|||||||
22
GreadyPoang/Popups/InfoPopup.xaml
Normal file
22
GreadyPoang/Popups/InfoPopup.xaml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentView
|
||||||
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:viewModels="clr-namespace:GreadyPoang.ViewModelLayer;assembly=GreadyPoang.ViewModelLayer"
|
||||||
|
x:Class="GreadyPoang.Popups.InfoPopup"
|
||||||
|
HorizontalOptions="Center"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
Padding="0"
|
||||||
|
x:DataType="viewModels:InfoPopupViewModel"
|
||||||
|
BackgroundColor="Transparent">
|
||||||
|
<VerticalStackLayout BackgroundColor="Aquamarine" Padding="5" Margin="0">
|
||||||
|
<Label HorizontalOptions="Center" TextColor="BlueViolet" Text="{Binding Title}" Style="{StaticResource Headline}" />
|
||||||
|
<Label HorizontalOptions="Center" Text="{Binding Name}" Style="{StaticResource SubHeadline}"/>
|
||||||
|
<Label HorizontalOptions="Center" Text="{Binding Message}" Style="{StaticResource StatusLabelStyle}"/>
|
||||||
|
<!--<Label Text="What is your name?" />
|
||||||
|
<Entry Text="{Binding Name}" />
|
||||||
|
|
||||||
|
<Button Text="Save" Command="{Binding SaveCommand}" />-->
|
||||||
|
<Button Margin="10" Text="Cancel" Command="{Binding CancelCommand}" Style="{StaticResource HoverButtonBlueStyle}" />
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</ContentView>
|
||||||
13
GreadyPoang/Popups/InfoPopup.xaml.cs
Normal file
13
GreadyPoang/Popups/InfoPopup.xaml.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using GreadyPoang.ViewModelLayer;
|
||||||
|
|
||||||
|
namespace GreadyPoang.Popups;
|
||||||
|
|
||||||
|
public partial class InfoPopup : ContentView
|
||||||
|
{
|
||||||
|
public InfoPopup(InfoPopupViewModel ipViewModel)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
BindingContext = ipViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -2,7 +2,10 @@
|
|||||||
<?xaml-comp compile="true" ?>
|
<?xaml-comp compile="true" ?>
|
||||||
<ResourceDictionary
|
<ResourceDictionary
|
||||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:local="clr-namespace:GreadyPoang.Common;assembly=GreadyPoang.Common" >
|
||||||
|
|
||||||
|
<local:HeaderColorConverter x:Key="HeaderColorConverter" />
|
||||||
|
|
||||||
<Style TargetType="StackLayout" x:Key="ResponsiveStackStyle">
|
<Style TargetType="StackLayout" x:Key="ResponsiveStackStyle">
|
||||||
<Setter Property="Orientation" Value="Horizontal"/>
|
<Setter Property="Orientation" Value="Horizontal"/>
|
||||||
@ -55,6 +58,12 @@
|
|||||||
<DataTrigger TargetType="Border" Binding="{Binding Status}" Value="Cancelled">
|
<DataTrigger TargetType="Border" Binding="{Binding Status}" Value="Cancelled">
|
||||||
<Setter Property="BackgroundColor" Value="LightCoral" />
|
<Setter Property="BackgroundColor" Value="LightCoral" />
|
||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
|
<DataTrigger TargetType="Border" Binding="{Binding Status}" Value="Winning">
|
||||||
|
<Setter Property="BackgroundColor" Value="Yellow" />
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger TargetType="Border" Binding="{Binding Status}" Value="Winner">
|
||||||
|
<Setter Property="BackgroundColor" Value="Red" />
|
||||||
|
</DataTrigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
|||||||
@ -1,17 +1,20 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
|
||||||
xmlns:partial="clr-namespace:GreadyPoang.ViewsPartial"
|
xmlns:partial="clr-namespace:GreadyPoang.ViewsPartial"
|
||||||
xmlns:vm="clr-namespace:GreadyPoang.CommandClasses"
|
xmlns:vm="clr-namespace:GreadyPoang.ViewModelLayer;assembly=GreadyPoang.ViewModelLayer"
|
||||||
xmlns:model="clr-namespace:GreadyPoang.EntityLayer;assembly=GreadyPoang.EntityLayer"
|
xmlns:model="clr-namespace:GreadyPoang.EntityLayer;assembly=GreadyPoang.EntityLayer"
|
||||||
x:Class="GreadyPoang.Views.ParticipantListView"
|
x:Class="GreadyPoang.Views.ParticipantListView"
|
||||||
x:DataType="vm:ParticipantViewModelCommands"
|
x:DataType="vm:ParticipantViewModel"
|
||||||
x:Name="ParticipantListPage"
|
x:Name="ParticipantListPage"
|
||||||
Title="Deltagar Lista">
|
Title="Deltagar Lista">
|
||||||
|
|
||||||
|
<!--xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"-->
|
||||||
<Border Style="{StaticResource Border.Page}" StrokeThickness="4">
|
<Border Style="{StaticResource Border.Page}" StrokeThickness="4">
|
||||||
<Grid Style="{StaticResource Grid.Page}">
|
<Grid Style="{StaticResource Grid.Page}">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
@ -20,11 +23,16 @@
|
|||||||
Grid.ColumnSpan="2"
|
Grid.ColumnSpan="2"
|
||||||
ViewTitle="Deltagare"
|
ViewTitle="Deltagare"
|
||||||
ViewDescription="Lägg till deltagare här" />
|
ViewDescription="Lägg till deltagare här" />
|
||||||
<Border Stroke="Gold" StrokeThickness="2" BackgroundColor="LemonChiffon" Grid.Row="1">
|
<ActivityIndicator Grid.Row="1" IsRunning="{Binding IsBusy}"
|
||||||
|
IsVisible="{Binding IsBusy}"
|
||||||
|
Color="DarkBlue"
|
||||||
|
HeightRequest="40" />
|
||||||
|
|
||||||
|
<Border Stroke="Gold" StrokeThickness="2" BackgroundColor="LemonChiffon" Grid.Row="2">
|
||||||
<VerticalStackLayout Spacing="4" >
|
<VerticalStackLayout Spacing="4" >
|
||||||
<Label Style="{StaticResource Label}"
|
<!--<Label Style="{StaticResource SubHeadline}"
|
||||||
Text="Deltagare "
|
Text="Deltagare "
|
||||||
FontAttributes="Bold" FontSize="Large"/>
|
FontAttributes="Bold" />-->
|
||||||
<Grid ColumnDefinitions="Auto,Auto,*" RowDefinitions="Auto,auto,auto,auto"
|
<Grid ColumnDefinitions="Auto,Auto,*" RowDefinitions="Auto,auto,auto,auto"
|
||||||
Padding="10" RowSpacing="8">
|
Padding="10" RowSpacing="8">
|
||||||
<Label Grid.Row="0" Grid.Column="0" Style="{StaticResource Label}"
|
<Label Grid.Row="0" Grid.Column="0" Style="{StaticResource Label}"
|
||||||
@ -58,7 +66,7 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</VerticalStackLayout>
|
</VerticalStackLayout>
|
||||||
</Border>
|
</Border>
|
||||||
<Border Grid.Row="2" Stroke="Gold" BackgroundColor="Ivory" StrokeThickness="2" Padding="5">
|
<Border Grid.Row="3" Stroke="Gold" BackgroundColor="Ivory" StrokeThickness="2" Padding="5">
|
||||||
<CollectionView
|
<CollectionView
|
||||||
x:Name="participants"
|
x:Name="participants"
|
||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
@ -67,7 +75,6 @@
|
|||||||
ItemsUpdatingScrollMode="KeepLastItemInView">
|
ItemsUpdatingScrollMode="KeepLastItemInView">
|
||||||
<CollectionView.ItemTemplate>
|
<CollectionView.ItemTemplate>
|
||||||
<DataTemplate x:DataType="model:Participant">
|
<DataTemplate x:DataType="model:Participant">
|
||||||
<!--Stroke="DarkGray" BackgroundColor="Cornsilk"-->
|
|
||||||
<Border Margin="8" Padding="12" >
|
<Border Margin="8" Padding="12" >
|
||||||
<VerticalStackLayout Spacing="4">
|
<VerticalStackLayout Spacing="4">
|
||||||
<Label FontAttributes="Bold"
|
<Label FontAttributes="Bold"
|
||||||
@ -76,7 +83,14 @@
|
|||||||
Text="{Binding LastNameFirstName}" />
|
Text="{Binding LastNameFirstName}" />
|
||||||
<HorizontalStackLayout >
|
<HorizontalStackLayout >
|
||||||
<Button Text="Edit" Style="{StaticResource HoverButtonBlueStyle}" CommandParameter="{Binding EditCommand}"/>
|
<Button Text="Edit" Style="{StaticResource HoverButtonBlueStyle}" CommandParameter="{Binding EditCommand}"/>
|
||||||
<Button Style="{StaticResource HoverButtonRedStyle}" Text="Delete" />
|
<Button Text="Delete" Style="{StaticResource HoverButtonRedStyle}"
|
||||||
|
Command="{Binding Source={RelativeSource AncestorType={x:Type vm:ParticipantViewModel}}, Path=DeleteAsyncCommand}"
|
||||||
|
CommandParameter="{Binding .}" />
|
||||||
|
|
||||||
|
<!--Command="{Binding BindingContext.ParticipantTappedCommand, Source={x:Reference Name=ParticipantList}}"
|
||||||
|
CommandParameter="{Binding .}" />-->
|
||||||
|
|
||||||
|
|
||||||
</HorizontalStackLayout>
|
</HorizontalStackLayout>
|
||||||
</VerticalStackLayout>
|
</VerticalStackLayout>
|
||||||
</Border>
|
</Border>
|
||||||
@ -84,6 +98,7 @@
|
|||||||
</CollectionView.ItemTemplate>
|
</CollectionView.ItemTemplate>
|
||||||
</CollectionView>
|
</CollectionView>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
@ -1,16 +1,16 @@
|
|||||||
using GreadyPoang.CommandClasses;
|
using GreadyPoang.ViewModelLayer;
|
||||||
|
|
||||||
namespace GreadyPoang.Views;
|
namespace GreadyPoang.Views;
|
||||||
|
|
||||||
public partial class ParticipantListView : ContentPage
|
public partial class ParticipantListView : ContentPage
|
||||||
{
|
{
|
||||||
public ParticipantListView(ParticipantViewModelCommands viewModel)
|
public ParticipantListView(ParticipantViewModel viewModel)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ViewModel = viewModel;
|
ViewModel = viewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ParticipantViewModelCommands ViewModel { get; set; }
|
public ParticipantViewModel ViewModel { get; set; }
|
||||||
public int ParticipantId { get; set; }
|
public int ParticipantId { get; set; }
|
||||||
|
|
||||||
protected override void OnAppearing()
|
protected override void OnAppearing()
|
||||||
@ -20,8 +20,11 @@ public partial class ParticipantListView : ContentPage
|
|||||||
ViewModel.Get();
|
ViewModel.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnDisappearing()
|
||||||
|
{
|
||||||
|
base.OnDisappearing();
|
||||||
|
ViewModel.PopupVisad = false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,14 +3,14 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
xmlns:partial="clr-namespace:GreadyPoang.ViewsPartial"
|
xmlns:partial="clr-namespace:GreadyPoang.ViewsPartial"
|
||||||
x:Class="GreadyPoang.Views.RoundRunningView"
|
x:Class="GreadyPoang.Views.RoundRunningView"
|
||||||
xmlns:vm ="clr-namespace:GreadyPoang.CommandClasses"
|
xmlns:vm ="clr-namespace:GreadyPoang.ViewModelLayer;assembly=GreadyPoang.ViewModelLayer"
|
||||||
xmlns:behaviors="clr-namespace:GreadyPoang.Common;assembly=GreadyPoang.Common"
|
xmlns:behaviors="clr-namespace:GreadyPoang.Common;assembly=GreadyPoang.Common"
|
||||||
xmlns:local="clr-namespace:GreadyPoang.EntityLayer;assembly=GreadyPoang.EntityLayer"
|
|
||||||
xmlns:model="clr-namespace:GreadyPoang.EntityLayer;assembly=GreadyPoang.EntityLayer"
|
xmlns:model="clr-namespace:GreadyPoang.EntityLayer;assembly=GreadyPoang.EntityLayer"
|
||||||
x:DataType="vm:RoundRunningViewModelCommands"
|
x:DataType="vm:RoundRunningViewModel"
|
||||||
Title="RoundRunningView">
|
Title="RoundRunningView">
|
||||||
|
<Border
|
||||||
<Border Style="{StaticResource Border.Page}" StrokeThickness="4">
|
behaviors:LoadedBehavior.Command="{Binding OnLoadedCommand}"
|
||||||
|
Style="{StaticResource Border.Page}" StrokeThickness="4">
|
||||||
<Grid Style="{StaticResource Grid.Page}">
|
<Grid Style="{StaticResource Grid.Page}">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
@ -27,6 +27,7 @@
|
|||||||
<CollectionView Grid.Row="1"
|
<CollectionView Grid.Row="1"
|
||||||
ItemsSource="{Binding RoundElements}"
|
ItemsSource="{Binding RoundElements}"
|
||||||
ItemsLayout="HorizontalList"
|
ItemsLayout="HorizontalList"
|
||||||
|
HeightRequest="125"
|
||||||
Margin="2">
|
Margin="2">
|
||||||
<CollectionView.ItemTemplate>
|
<CollectionView.ItemTemplate>
|
||||||
<DataTemplate x:DataType="model:RoundBuilderElement">
|
<DataTemplate x:DataType="model:RoundBuilderElement">
|
||||||
@ -78,23 +79,44 @@
|
|||||||
<Entry.Behaviors>
|
<Entry.Behaviors>
|
||||||
<behaviors:DigitsOnlyBehavior/>
|
<behaviors:DigitsOnlyBehavior/>
|
||||||
<behaviors:EventToCommandBehavior EventName="Completed"
|
<behaviors:EventToCommandBehavior EventName="Completed"
|
||||||
Command="{Binding StoreAndHandlePointsCommand}" />
|
Command="{Binding StoreAndHandlePointsAsyncCommand}" />
|
||||||
</Entry.Behaviors>
|
</Entry.Behaviors>
|
||||||
</Entry>
|
</Entry>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Button Text="Register Points"
|
<Button Text="Register Points"
|
||||||
Style="{StaticResource HoverButtonRedStyle}"
|
Style="{StaticResource HoverButtonRedStyle}"
|
||||||
Command="{Binding StoreAndHandlePointsCommand}"/>
|
Command="{Binding StoreAndHandlePointsAsyncCommand}"/>
|
||||||
</HorizontalStackLayout>
|
</HorizontalStackLayout>
|
||||||
</Border>
|
</Border>
|
||||||
<ScrollView Grid.Row="4" Orientation="Horizontal">
|
|
||||||
<Grid
|
<ScrollView Grid.Row="4" Orientation="Horizontal">
|
||||||
x:Name="ScoreGrid"
|
<HorizontalStackLayout
|
||||||
ColumnSpacing="5"
|
BindableLayout.ItemsSource="{Binding ScoreColumns}"
|
||||||
RowSpacing="5"
|
x:Name="ScoreGrid">
|
||||||
Padding="3"
|
<BindableLayout.ItemTemplate>
|
||||||
HorizontalOptions="FillAndExpand"
|
<DataTemplate x:DataType="model:ScoreColumn">
|
||||||
VerticalOptions="FillAndExpand" />
|
<VerticalStackLayout BindableLayout.ItemsSource="{Binding Cells}">
|
||||||
|
<BindableLayout.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="model:ScoreCell">
|
||||||
|
<Border
|
||||||
|
Stroke="Gray"
|
||||||
|
StrokeThickness="1"
|
||||||
|
BackgroundColor="{Binding IsHeader, Converter={StaticResource HeaderColorConverter}}"
|
||||||
|
Margin="1"
|
||||||
|
Padding="2">
|
||||||
|
<Label
|
||||||
|
Text="{Binding Text}"
|
||||||
|
FontAttributes="{Binding IsHeader, Converter={StaticResource FontWeightConverter}}"
|
||||||
|
TextColor="{Binding IsHeader, Converter={StaticResource TextColorConverter}}"
|
||||||
|
HorizontalOptions="Center"
|
||||||
|
VerticalOptions="Center" />
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</BindableLayout.ItemTemplate>
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</DataTemplate>
|
||||||
|
</BindableLayout.ItemTemplate>
|
||||||
|
</HorizontalStackLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|||||||
@ -1,95 +1,12 @@
|
|||||||
using GreadyPoang.CommandClasses;
|
using GreadyPoang.ViewModelLayer;
|
||||||
using GreadyPoang.EntityLayer;
|
|
||||||
|
|
||||||
namespace GreadyPoang.Views;
|
namespace GreadyPoang.Views;
|
||||||
|
|
||||||
public partial class RoundRunningView : ContentPage
|
public partial class RoundRunningView : ContentPage
|
||||||
{
|
{
|
||||||
public RoundRunningView(RoundRunningViewModelCommands viewModel)
|
public RoundRunningView(RoundRunningViewModel viewModel)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ViewModel = viewModel;
|
BindingContext = viewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnAppearing()
|
|
||||||
{
|
|
||||||
base.OnAppearing();
|
|
||||||
BindingContext = ViewModel;
|
|
||||||
ViewModel.Get();
|
|
||||||
//BuildScoreGrid(ViewModel.PlayerColumns); // <-- h<>r bygger du layouten
|
|
||||||
ViewModel.RebuildRequested += ViewModel_RebuildRequested;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ViewModel_RebuildRequested(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
BuildScoreGrid(ViewModel.PlayerColumns); // <-- h<>r bygger du layouten
|
|
||||||
}
|
|
||||||
|
|
||||||
//protected override
|
|
||||||
|
|
||||||
public RoundRunningViewModelCommands ViewModel { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private void BuildScoreGrid(IEnumerable<PlayerColumn> columns)
|
|
||||||
{
|
|
||||||
ScoreGrid.ColumnDefinitions.Clear();
|
|
||||||
ScoreGrid.RowDefinitions.Clear();
|
|
||||||
ScoreGrid.Children.Clear();
|
|
||||||
|
|
||||||
int maxRows = columns.Max(c => c.Values.Count);
|
|
||||||
|
|
||||||
// Skapa rader
|
|
||||||
for (int row = 0; row < maxRows + 1; row++) // +1 f<>r rubrikraden
|
|
||||||
{
|
|
||||||
ScoreGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
|
|
||||||
}
|
|
||||||
|
|
||||||
int colIndex = 0;
|
|
||||||
foreach (var column in columns)
|
|
||||||
{
|
|
||||||
ScoreGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
|
|
||||||
|
|
||||||
var headerCell = CreateCell(column.PlayerName, isHeader: true);
|
|
||||||
ScoreGrid.Children.Add(headerCell);
|
|
||||||
Grid.SetRow(headerCell, 0);
|
|
||||||
Grid.SetColumn(headerCell, colIndex);
|
|
||||||
|
|
||||||
// V<>rdeceller
|
|
||||||
for (int rowIndex = 0; rowIndex < column.Values.Count; rowIndex++)
|
|
||||||
{
|
|
||||||
var value = column.Values[rowIndex];
|
|
||||||
var cell = CreateCell(value);
|
|
||||||
ScoreGrid.Children.Add(cell);
|
|
||||||
Grid.SetRow(cell, rowIndex + 1); // +1 f<>r att hoppa <20>ver rubrikraden
|
|
||||||
Grid.SetColumn(cell, colIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
colIndex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private View CreateCell(string text, bool isHeader = false)
|
|
||||||
{
|
|
||||||
return new Border
|
|
||||||
{
|
|
||||||
Stroke = Colors.Gray,
|
|
||||||
StrokeThickness = 1,
|
|
||||||
BackgroundColor = isHeader ? Colors.DarkGray : Colors.Yellow,
|
|
||||||
Margin = 1,
|
|
||||||
Padding = 2,
|
|
||||||
Content = new Label
|
|
||||||
{
|
|
||||||
Text = text,
|
|
||||||
FontAttributes = isHeader ? FontAttributes.Bold : FontAttributes.None,
|
|
||||||
TextColor = isHeader ? Colors.White : Colors.Black,
|
|
||||||
HorizontalOptions = LayoutOptions.Center,
|
|
||||||
VerticalOptions = LayoutOptions.Center
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
101
GreadyPoang/Views/RoundRunningViewOld.xaml
Normal file
101
GreadyPoang/Views/RoundRunningViewOld.xaml
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:partial="clr-namespace:GreadyPoang.ViewsPartial"
|
||||||
|
x:Class="GreadyPoang.Views.RoundRunningView"
|
||||||
|
xmlns:vm ="clr-namespace:GreadyPoang.ViewModelLayer;assembly=GreadyPoang.ViewModelLayer"
|
||||||
|
xmlns:behaviors="clr-namespace:GreadyPoang.Common;assembly=GreadyPoang.Common"
|
||||||
|
xmlns:local="clr-namespace:GreadyPoang.EntityLayer;assembly=GreadyPoang.EntityLayer"
|
||||||
|
xmlns:model="clr-namespace:GreadyPoang.EntityLayer;assembly=GreadyPoang.EntityLayer"
|
||||||
|
x:DataType="vm:RoundRunningViewModel"
|
||||||
|
Title="RoundRunningView">
|
||||||
|
|
||||||
|
<Border Style="{StaticResource Border.Page}" StrokeThickness="4">
|
||||||
|
<Grid Style="{StaticResource Grid.Page}">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<partial:HeaderView Grid.Row="0"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
ViewTitle="Starta eller fortsätt en registrerad Runda"
|
||||||
|
ViewDescription="Deltagarna visas först!" />
|
||||||
|
<CollectionView Grid.Row="1"
|
||||||
|
ItemsSource="{Binding RoundElements}"
|
||||||
|
ItemsLayout="HorizontalList"
|
||||||
|
Margin="2">
|
||||||
|
<CollectionView.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="model:RoundBuilderElement">
|
||||||
|
<Border Stroke="Gray"
|
||||||
|
Padding="10"
|
||||||
|
Margin="5"
|
||||||
|
StrokeShape="RoundRectangle 10"
|
||||||
|
Style="{StaticResource StatusBorderStyle}">
|
||||||
|
<Border.GestureRecognizers>
|
||||||
|
<TapGestureRecognizer
|
||||||
|
Command="{Binding Source={RelativeSource AncestorType={x:Type ContentPage}}, Path=BindingContext.ParticipantTappedCommand}"
|
||||||
|
CommandParameter="{Binding .}" />
|
||||||
|
</Border.GestureRecognizers>
|
||||||
|
<Grid VerticalOptions="Fill" >
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Label Grid.Row="0" Text="Spelare" />
|
||||||
|
<Label Grid.Row="1" Text="{Binding ParticipantName}" FontAttributes="Bold" Style="{StaticResource StatusLabelStyle}" />
|
||||||
|
<Label Grid.Row="2" Text="{Binding GameRegPoints, StringFormat='Poäng: {0}'}" Style="{StaticResource StatusLabelStyle}" />
|
||||||
|
<Label Grid.Row="3" Text="{Binding Status}" Style="{StaticResource StatusLabelStyle}"/>
|
||||||
|
<Label Grid.Row="4" Text="{Binding GameRoundStartDate, StringFormat='Start: {0:yyyy-MM-dd}'}" Style="{StaticResource StatusLabelStyle}"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</CollectionView.ItemTemplate>
|
||||||
|
</CollectionView>
|
||||||
|
<BoxView
|
||||||
|
Grid.Row="2"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
Margin="0,0,0,5"
|
||||||
|
HeightRequest="1"
|
||||||
|
Color="Black" />
|
||||||
|
<Border Grid.Row="3">
|
||||||
|
<HorizontalStackLayout>
|
||||||
|
<Grid VerticalOptions="Fill">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Label Grid.Row="0" Text="{Binding BuilderObject.GameRoundId, StringFormat='Runda: {0}'}"/>
|
||||||
|
<Label Grid.Row="1" Text="{Binding BuilderObject.ParticipantName}" FontAttributes="Bold" FontSize="Subtitle" />
|
||||||
|
<Entry Grid.Row="2" x:Name="Points" Placeholder="Latest Points" Text="{Binding BuilderObject.GameRegPoints}" FontAttributes="Bold" FontSize="20" >
|
||||||
|
<Entry.Behaviors>
|
||||||
|
<behaviors:DigitsOnlyBehavior/>
|
||||||
|
<behaviors:EventToCommandBehavior EventName="Completed"
|
||||||
|
Command="{Binding StoreAndHandlePointsAsyncCommand}" />
|
||||||
|
</Entry.Behaviors>
|
||||||
|
</Entry>
|
||||||
|
</Grid>
|
||||||
|
<Button Text="Register Points"
|
||||||
|
Style="{StaticResource HoverButtonRedStyle}"
|
||||||
|
Command="{Binding StoreAndHandlePointsAsyncCommand}"/>
|
||||||
|
</HorizontalStackLayout>
|
||||||
|
</Border>
|
||||||
|
<ScrollView Grid.Row="4" Orientation="Horizontal">
|
||||||
|
<Grid
|
||||||
|
x:Name="ScoreGrid"
|
||||||
|
ColumnSpacing="5"
|
||||||
|
RowSpacing="5"
|
||||||
|
Padding="3"
|
||||||
|
HorizontalOptions="FillAndExpand"
|
||||||
|
VerticalOptions="FillAndExpand" />
|
||||||
|
</ScrollView>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</ContentPage>
|
||||||
105
GreadyPoang/Views/RoundRunningViewOld.xaml.cs
Normal file
105
GreadyPoang/Views/RoundRunningViewOld.xaml.cs
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
using GreadyPoang.EntityLayer;
|
||||||
|
using GreadyPoang.ViewModelLayer;
|
||||||
|
|
||||||
|
namespace GreadyPoang.Views;
|
||||||
|
|
||||||
|
public partial class RoundRunningView : ContentPage
|
||||||
|
{
|
||||||
|
public RoundRunningView(RoundRunningViewModel viewModel)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
ViewModel = viewModel;
|
||||||
|
ViewModel.RebuildRequested += ViewModel_RebuildRequested;
|
||||||
|
this.Loaded += OnPageLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnPageLoaded(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ViewModel.Get();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAppearing()
|
||||||
|
{
|
||||||
|
base.OnAppearing();
|
||||||
|
BindingContext = ViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void ViewModel_RebuildRequested(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
BuildScoreGrid(ViewModel.PlayerColumns); // <-- h<>r bygger du layouten
|
||||||
|
}
|
||||||
|
|
||||||
|
//protected override
|
||||||
|
|
||||||
|
public RoundRunningViewModel ViewModel { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
private void BuildScoreGrid(IEnumerable<PlayerColumn> columns)
|
||||||
|
{
|
||||||
|
ScoreGrid.ColumnDefinitions.Clear();
|
||||||
|
ScoreGrid.RowDefinitions.Clear();
|
||||||
|
ScoreGrid.Children.Clear();
|
||||||
|
|
||||||
|
int maxRows = columns.Max(c => c.Values.Count);
|
||||||
|
|
||||||
|
// Skapa rader
|
||||||
|
for (int row = 0; row < maxRows + 1; row++) // +1 f<>r rubrikraden
|
||||||
|
{
|
||||||
|
ScoreGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
|
||||||
|
}
|
||||||
|
|
||||||
|
int colIndex = 0;
|
||||||
|
foreach (var column in columns)
|
||||||
|
{
|
||||||
|
ScoreGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
|
||||||
|
|
||||||
|
var headerCell = CreateCell(column.PlayerName, isHeader: true);
|
||||||
|
ScoreGrid.Children.Add(headerCell);
|
||||||
|
Grid.SetRow(headerCell, 0);
|
||||||
|
Grid.SetColumn(headerCell, colIndex);
|
||||||
|
|
||||||
|
// V<>rdeceller
|
||||||
|
for (int rowIndex = 0; rowIndex < column.Values.Count; rowIndex++)
|
||||||
|
{
|
||||||
|
var value = column.Values[rowIndex];
|
||||||
|
var cell = CreateCell(value);
|
||||||
|
ScoreGrid.Children.Add(cell);
|
||||||
|
Grid.SetRow(cell, column.Values.Count - rowIndex); // +1 f<>r att hoppa <20>ver rubrikraden
|
||||||
|
Grid.SetColumn(cell, colIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
colIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private View CreateCell(string text, bool isHeader = false)
|
||||||
|
{
|
||||||
|
return new Border
|
||||||
|
{
|
||||||
|
Stroke = Colors.Gray,
|
||||||
|
StrokeThickness = 1,
|
||||||
|
BackgroundColor = isHeader ? Colors.DarkGray : Colors.Yellow,
|
||||||
|
Margin = 1,
|
||||||
|
Padding = 2,
|
||||||
|
Content = new Label
|
||||||
|
{
|
||||||
|
Text = text,
|
||||||
|
FontAttributes = isHeader ? FontAttributes.Bold : FontAttributes.None,
|
||||||
|
TextColor = isHeader ? Colors.White : Colors.Black,
|
||||||
|
HorizontalOptions = LayoutOptions.Center,
|
||||||
|
VerticalOptions = LayoutOptions.Center
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDisappearing()
|
||||||
|
{
|
||||||
|
base.OnDisappearing();
|
||||||
|
ViewModel.PopupVisad = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3,10 +3,10 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
xmlns:partial="clr-namespace:GreadyPoang.ViewsPartial"
|
xmlns:partial="clr-namespace:GreadyPoang.ViewsPartial"
|
||||||
x:Class="GreadyPoang.Views.RoundStartingView"
|
x:Class="GreadyPoang.Views.RoundStartingView"
|
||||||
xmlns:vm="clr-namespace:GreadyPoang.CommandClasses"
|
xmlns:vm="clr-namespace:GreadyPoang.ViewModelLayer;assembly=GreadyPoang.ViewModelLayer"
|
||||||
xmlns:local="clr-namespace:GreadyPoang.EntityLayer;assembly=GreadyPoang.EntityLayer"
|
xmlns:local="clr-namespace:GreadyPoang.EntityLayer;assembly=GreadyPoang.EntityLayer"
|
||||||
xmlns:model="clr-namespace:GreadyPoang.EntityLayer;assembly=GreadyPoang.EntityLayer"
|
xmlns:model="clr-namespace:GreadyPoang.EntityLayer;assembly=GreadyPoang.EntityLayer"
|
||||||
x:DataType="vm:RoundStartingViewModelCommands"
|
x:DataType="vm:RoundStartingViewModel"
|
||||||
x:Name="GameRoundStartingPage"
|
x:Name="GameRoundStartingPage"
|
||||||
Title="Starta ny Runda">
|
Title="Starta ny Runda">
|
||||||
|
|
||||||
@ -25,15 +25,15 @@
|
|||||||
ViewDescription="Välj deltagare och initiera spel" />
|
ViewDescription="Välj deltagare och initiera spel" />
|
||||||
<Border Grid.Row="1" Stroke="Gold" StrokeThickness="2" BackgroundColor="LemonChiffon" >
|
<Border Grid.Row="1" Stroke="Gold" StrokeThickness="2" BackgroundColor="LemonChiffon" >
|
||||||
<ScrollView Orientation="Horizontal">
|
<ScrollView Orientation="Horizontal">
|
||||||
<StackLayout x:Name="ResponsiveStack" Spacing="5" Style="{StaticResource ResponsiveStackStyle}" >
|
<StackLayout x:Name="ResponsiveStack" Spacing="5" HeightRequest="125" Style="{StaticResource ResponsiveStackStyle}" >
|
||||||
<Border Stroke="Gray"
|
<Border Stroke="Gray"
|
||||||
StrokeThickness="2"
|
StrokeThickness="2"
|
||||||
BackgroundColor="LightGray"
|
BackgroundColor="LightGray"
|
||||||
Padding="10"
|
Padding="10"
|
||||||
Margin="2"
|
Margin="2"
|
||||||
HorizontalOptions="Start"
|
HorizontalOptions="Start"
|
||||||
VerticalOptions="Center"
|
VerticalOptions="Center"
|
||||||
WidthRequest="250">
|
WidthRequest="250">
|
||||||
<Picker ItemsSource="{Binding ParticipantList}"
|
<Picker ItemsSource="{Binding ParticipantList}"
|
||||||
ItemDisplayBinding="{Binding LastNameFirstName}"
|
ItemDisplayBinding="{Binding LastNameFirstName}"
|
||||||
SelectedItem="{Binding SelectedItem}"
|
SelectedItem="{Binding SelectedItem}"
|
||||||
@ -64,7 +64,7 @@
|
|||||||
>
|
>
|
||||||
<Border.GestureRecognizers>
|
<Border.GestureRecognizers>
|
||||||
<TapGestureRecognizer
|
<TapGestureRecognizer
|
||||||
Command="{Binding BindingContext.ParticipantTappedCommand, Source={x:Reference Name=ParticipantList}}"
|
Command="{Binding BindingContext.SelectNewlyAddedParticipantCommand, Source={x:Reference Name=ParticipantList}}"
|
||||||
CommandParameter="{Binding .}" />
|
CommandParameter="{Binding .}" />
|
||||||
</Border.GestureRecognizers>
|
</Border.GestureRecognizers>
|
||||||
<Border Margin="1" Padding="2" StrokeThickness="3" >
|
<Border Margin="1" Padding="2" StrokeThickness="3" >
|
||||||
@ -80,16 +80,16 @@
|
|||||||
</CollectionView>
|
</CollectionView>
|
||||||
</Border>
|
</Border>
|
||||||
<Border
|
<Border
|
||||||
HorizontalOptions="Start"
|
HorizontalOptions="Start"
|
||||||
Padding="2"
|
Padding="2"
|
||||||
Margin="5"
|
Margin="5"
|
||||||
WidthRequest="150"
|
WidthRequest="150"
|
||||||
HeightRequest="100"
|
HeightRequest="100"
|
||||||
Stroke="LightGray"
|
Stroke="LightGray"
|
||||||
StrokeThickness="1"
|
StrokeThickness="1"
|
||||||
x:Name="RoundElementBorder"
|
x:Name="RoundElementBorder"
|
||||||
BackgroundColor="BlanchedAlmond"
|
BackgroundColor="BlanchedAlmond"
|
||||||
StrokeShape="RoundRectangle 10">
|
StrokeShape="RoundRectangle 10">
|
||||||
<VerticalStackLayout Spacing="5" Padding="4">
|
<VerticalStackLayout Spacing="5" Padding="4">
|
||||||
<Button Text="Spara omgång" WidthRequest="130"
|
<Button Text="Spara omgång" WidthRequest="130"
|
||||||
Style="{StaticResource HoverButtonBlueStyle}"
|
Style="{StaticResource HoverButtonBlueStyle}"
|
||||||
@ -119,6 +119,7 @@
|
|||||||
ItemsLayout="HorizontalList"
|
ItemsLayout="HorizontalList"
|
||||||
x:Name="InnerList"
|
x:Name="InnerList"
|
||||||
Margin="0,10,0,10"
|
Margin="0,10,0,10"
|
||||||
|
HeightRequest="90"
|
||||||
ItemSizingStrategy="MeasureAllItems">
|
ItemSizingStrategy="MeasureAllItems">
|
||||||
<CollectionView.ItemTemplate>
|
<CollectionView.ItemTemplate>
|
||||||
<DataTemplate x:DataType="model:RoundBuilderElement">
|
<DataTemplate x:DataType="model:RoundBuilderElement">
|
||||||
@ -129,7 +130,7 @@
|
|||||||
Style="{StaticResource StatusBorderStyle}" >
|
Style="{StaticResource StatusBorderStyle}" >
|
||||||
<Border.GestureRecognizers>
|
<Border.GestureRecognizers>
|
||||||
<TapGestureRecognizer
|
<TapGestureRecognizer
|
||||||
Command="{Binding Path=BindingContext.ElementTappedCommand,Source={x:Reference OuterList}}"
|
Command="{Binding Path=BindingContext.RoundSelectedCommand ,Source={x:Reference OuterList}}"
|
||||||
CommandParameter="{Binding .}" />
|
CommandParameter="{Binding .}" />
|
||||||
</Border.GestureRecognizers>
|
</Border.GestureRecognizers>
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using GreadyPoang.CommandClasses;
|
using GreadyPoang.ViewModelLayer;
|
||||||
|
|
||||||
namespace GreadyPoang.Views;
|
namespace GreadyPoang.Views;
|
||||||
|
|
||||||
@ -6,12 +6,12 @@ public partial class RoundStartingView : ContentPage
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public RoundStartingView(RoundStartingViewModelCommands viewModel)
|
public RoundStartingView(RoundStartingViewModel viewModel)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ViewModel = viewModel;
|
ViewModel = viewModel;
|
||||||
}
|
}
|
||||||
public RoundStartingViewModelCommands ViewModel { get; set; }
|
public RoundStartingViewModel ViewModel { get; set; }
|
||||||
|
|
||||||
public int GameRoundId { get; set; }
|
public int GameRoundId { get; set; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user