Compare commits
9 Commits
UtanSplash
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 02a26871c6 | |||
| c00819bec6 | |||
| fa6c1e125f | |||
| 5689765451 | |||
| b567291063 | |||
| a449dbeab3 | |||
| 11f0594233 | |||
| cbf018a890 | |||
| f1077febc4 |
@ -1,7 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFrameworks>
|
||||
net9.0-android;
|
||||
net9.0-ios;
|
||||
net9.0-maccatalyst;
|
||||
net9.0-windows10.0.19041
|
||||
</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
0
Example.cs
Normal file
0
Example.cs
Normal file
15
GreadyPoang.CommandClasses/GreadyPoang.CommandClasses.csproj
Normal file
15
GreadyPoang.CommandClasses/GreadyPoang.CommandClasses.csproj
Normal file
@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Common.Library\Common.Library.csproj" />
|
||||
<ProjectReference Include="..\GreadyPoang.EntityLayer\GreadyPoang.EntityLayer.csproj" />
|
||||
<ProjectReference Include="..\GreadyPoang.ViewModelLayer\GreadyPoang.ViewModelLayer.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
public class BehaviorBase<T> : Behavior<T> where T : BindableObject
|
||||
{
|
||||
public T AssociatedObject { get; private set; }
|
||||
public T? AssociatedObject { get; private set; }
|
||||
|
||||
protected override void OnAttachedTo(T bindable)
|
||||
{
|
||||
@ -22,8 +22,9 @@ public class BehaviorBase<T> : Behavior<T> where T : BindableObject
|
||||
AssociatedObject = null;
|
||||
}
|
||||
|
||||
void OnBindingContextChanged(object sender, EventArgs e)
|
||||
void OnBindingContextChanged(object? sender, EventArgs e)
|
||||
{
|
||||
if (AssociatedObject != null)
|
||||
BindingContext = AssociatedObject.BindingContext;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFrameworks>
|
||||
net9.0-android;
|
||||
net9.0-ios;
|
||||
net9.0-maccatalyst;
|
||||
net9.0-windows10.0.19041
|
||||
</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -2,21 +2,27 @@
|
||||
|
||||
namespace GreadyPoang.Common;
|
||||
|
||||
public class DigitsOnlyBehavior : Behavior<Entry>
|
||||
public class DigitsOnlyBehavior : Behavior<Entry?>
|
||||
{
|
||||
protected override void OnAttachedTo(Entry entry)
|
||||
protected override void OnAttachedTo(Entry? entry)
|
||||
{
|
||||
if (entry != null)
|
||||
{
|
||||
entry.TextChanged += OnTextChanged;
|
||||
}
|
||||
base.OnAttachedTo(entry);
|
||||
}
|
||||
|
||||
protected override void OnDetachingFrom(Entry entry)
|
||||
protected override void OnDetachingFrom(Entry? entry)
|
||||
{
|
||||
if (entry != null)
|
||||
{
|
||||
entry.TextChanged -= OnTextChanged;
|
||||
}
|
||||
base.OnDetachingFrom(entry);
|
||||
}
|
||||
|
||||
private void OnTextChanged(object sender, TextChangedEventArgs e)
|
||||
private void OnTextChanged(object? sender, TextChangedEventArgs e)
|
||||
{
|
||||
var entry = sender as Entry;
|
||||
if (entry == null) return;
|
||||
|
||||
@ -4,7 +4,7 @@ using System.Windows.Input;
|
||||
namespace GreadyPoang.Common;
|
||||
public class EventToCommandBehavior : BehaviorBase<VisualElement>
|
||||
{
|
||||
public string EventName { get; set; }
|
||||
public required string EventName { get; set; }
|
||||
|
||||
public static readonly BindableProperty CommandProperty =
|
||||
BindableProperty.Create(nameof(Command), typeof(ICommand), typeof(EventToCommandBehavior));
|
||||
@ -15,8 +15,9 @@ public class EventToCommandBehavior : BehaviorBase<VisualElement>
|
||||
set => SetValue(CommandProperty, value);
|
||||
}
|
||||
|
||||
private EventInfo eventInfo;
|
||||
private Delegate eventHandler;
|
||||
// Fix for CS8618: Make the field nullable and fix IDE1006: Add '_' prefix
|
||||
private EventInfo? _eventInfo;
|
||||
private Delegate? _eventHandler;
|
||||
|
||||
protected override void OnAttachedTo(VisualElement bindable)
|
||||
{
|
||||
@ -25,21 +26,29 @@ public class EventToCommandBehavior : BehaviorBase<VisualElement>
|
||||
if (bindable == null || string.IsNullOrEmpty(EventName))
|
||||
return;
|
||||
|
||||
eventInfo = bindable.GetType().GetRuntimeEvent(EventName);
|
||||
if (eventInfo == null)
|
||||
var runtimeEvent = bindable.GetType().GetRuntimeEvent(EventName);
|
||||
if (runtimeEvent == null)
|
||||
throw new ArgumentException($"Event '{EventName}' not found on type '{bindable.GetType().Name}'");
|
||||
|
||||
MethodInfo methodInfo = typeof(EventToCommandBehavior).GetTypeInfo().GetDeclaredMethod(nameof(OnEvent));
|
||||
eventHandler = methodInfo.CreateDelegate(eventInfo.EventHandlerType, this);
|
||||
eventInfo.AddEventHandler(bindable, eventHandler);
|
||||
_eventInfo = runtimeEvent;
|
||||
|
||||
MethodInfo? methodInfo = typeof(EventToCommandBehavior).GetTypeInfo().GetDeclaredMethod(nameof(OnEvent));
|
||||
if (methodInfo == null)
|
||||
throw new InvalidOperationException($"Method '{nameof(OnEvent)}' not found on type '{typeof(EventToCommandBehavior).Name}'");
|
||||
|
||||
if (_eventInfo.EventHandlerType == null)
|
||||
throw new InvalidOperationException($"EventHandlerType for event '{EventName}' is null on type '{bindable.GetType().Name}'");
|
||||
|
||||
_eventHandler = methodInfo.CreateDelegate(_eventInfo.EventHandlerType, this);
|
||||
_eventInfo.AddEventHandler(bindable, _eventHandler);
|
||||
}
|
||||
|
||||
protected override void OnDetachingFrom(VisualElement bindable)
|
||||
{
|
||||
base.OnDetachingFrom(bindable);
|
||||
|
||||
if (eventInfo != null && eventHandler != null)
|
||||
eventInfo.RemoveEventHandler(bindable, eventHandler);
|
||||
if (_eventInfo != null && _eventHandler != null)
|
||||
_eventInfo.RemoveEventHandler(bindable, _eventHandler);
|
||||
}
|
||||
|
||||
private void OnEvent(object sender, object eventArgs)
|
||||
|
||||
@ -52,14 +52,14 @@ public class CombinedRepository : ICombinedRepository
|
||||
gp.GamePointId,
|
||||
gp.GameRoundId,
|
||||
gp.GameRoundRegNr,
|
||||
gp.GameRegPoints,
|
||||
latest.totPoints as GameRegPoints,
|
||||
gr.GameRoundStartDate,
|
||||
gr.GameStatus AS Status,
|
||||
p.ParticipantId,
|
||||
(p.LastName || ' ' || p.FirstName) AS ParticipantName
|
||||
FROM GamePoints gp
|
||||
INNER JOIN (
|
||||
SELECT ParticipantId, GameRoundId, MAX(GamePointId) AS MaxGamePointId
|
||||
SELECT ParticipantId, GameRoundId, MAX(GamePointId) AS MaxGamePointId , sum(GameRegPoints) AS totPoints
|
||||
FROM GamePoints
|
||||
GROUP BY ParticipantId, GameRoundId
|
||||
) latest ON gp.GamePointId = latest.MaxGamePointId
|
||||
@ -74,7 +74,7 @@ public class CombinedRepository : ICombinedRepository
|
||||
public IEnumerable<RoundBuilderElement> roundBuilderElementsDbById(int GameId)
|
||||
{
|
||||
var result = _context.RoundBuilderElements
|
||||
.FromSqlRaw($@"
|
||||
.FromSql($@"
|
||||
SELECT
|
||||
gp.GamePointId,
|
||||
gp.GameRoundId,
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFrameworks>
|
||||
net9.0-android;
|
||||
net9.0-ios;
|
||||
net9.0-maccatalyst;
|
||||
net9.0-windows10.0.19041
|
||||
</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -5,5 +5,7 @@ public enum GamePointStatus
|
||||
New = 0,
|
||||
InProgress = 1,
|
||||
Completed = 2,
|
||||
Cancelled = 3
|
||||
Cancelled = 3,
|
||||
Winning = 4,
|
||||
Winner = 5
|
||||
}
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFrameworks>
|
||||
net9.0-android;
|
||||
net9.0-ios;
|
||||
net9.0-maccatalyst;
|
||||
net9.0-windows10.0.19041
|
||||
</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -123,6 +123,4 @@ public class RoundBuilderElement : EntityBase
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -2,7 +2,12 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFrameworks>
|
||||
net9.0-android;
|
||||
net9.0-ios;
|
||||
net9.0-maccatalyst;
|
||||
net9.0-windows10.0.19041
|
||||
</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFrameworks>
|
||||
net9.0-android;
|
||||
net9.0-ios;
|
||||
net9.0-maccatalyst;
|
||||
net9.0-windows10.0.19041
|
||||
</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -4,5 +4,6 @@ namespace GreadyPoang.Services;
|
||||
|
||||
public class ObjectMessageService : IObjectMessageService
|
||||
{
|
||||
public RoundBuilderGroup CurrentGroup { get; set; }
|
||||
public required RoundBuilderGroup CurrentGroup { get; set; }
|
||||
public bool Delivered { get; set; } = false;
|
||||
}
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
using GreadyPoang.EntityLayer;
|
||||
|
||||
namespace GreadyPoang.Services;
|
||||
|
||||
public interface IObjectMessageService
|
||||
namespace GreadyPoang.Services
|
||||
{
|
||||
public interface IObjectMessageService
|
||||
{
|
||||
RoundBuilderGroup CurrentGroup { get; set; }
|
||||
|
||||
bool Delivered { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFrameworks>
|
||||
net9.0-android;
|
||||
net9.0-ios;
|
||||
net9.0-maccatalyst;
|
||||
net9.0-windows10.0.19041
|
||||
</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
namespace GreadyPoang.Core;
|
||||
|
||||
public interface INavigationService
|
||||
{
|
||||
Task NavigateToAsync(string route);
|
||||
Task NavigateToPageAsync(Page page);
|
||||
|
||||
}
|
||||
|
||||
6
GreadyPoang.ViewModelLayer/Interfaces/IPageFactory.cs
Normal file
6
GreadyPoang.ViewModelLayer/Interfaces/IPageFactory.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace GreadyPoang.Core;
|
||||
|
||||
public interface IPageFactory
|
||||
{
|
||||
Page CreateRoundPage();
|
||||
}
|
||||
9
GreadyPoang.ViewModelLayer/Interfaces/ISplashService.cs
Normal file
9
GreadyPoang.ViewModelLayer/Interfaces/ISplashService.cs
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
namespace GreadyPoang.Core;
|
||||
|
||||
public interface ISplashService
|
||||
{
|
||||
Task ShowSplash(string text = "Välkommen!", int durationMs = 3000);
|
||||
Task HideAsync();
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
using Common.Library;
|
||||
|
||||
namespace GreadyPoang.ViewModelLayer;
|
||||
|
||||
public class AppShellViewModel : ViewModelBase
|
||||
{
|
||||
|
||||
private bool _roundRounningVisible = true;
|
||||
|
||||
public bool RoundRunningVisible
|
||||
{
|
||||
get { return _roundRounningVisible; }
|
||||
set
|
||||
{
|
||||
_roundRounningVisible = value;
|
||||
RaisePropertyChanged(nameof(RoundRunningVisible));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
using Common.Library;
|
||||
using GreadyPoang.Services;
|
||||
|
||||
namespace GreadyPoang.ViewModelLayer;
|
||||
|
||||
public class MainPageViewModel : ViewModelBase
|
||||
{
|
||||
private readonly AppShellViewModel _appShell;
|
||||
private readonly IObjectMessageService _messageService;
|
||||
|
||||
public MainPageViewModel(
|
||||
AppShellViewModel appShell,
|
||||
IObjectMessageService messageService
|
||||
) : base()
|
||||
{
|
||||
|
||||
_appShell = appShell;
|
||||
_messageService = messageService;
|
||||
|
||||
}
|
||||
|
||||
public void InitMessage()
|
||||
{
|
||||
if (_appShell.RoundRunningVisible == false)
|
||||
{
|
||||
_messageService.Delivered = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
using Common.Library;
|
||||
using GreadyPoang.EntityLayer;
|
||||
using GreadyPoang.Services;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
|
||||
@ -13,10 +14,16 @@ public class ParticipantViewModel : ViewModelBase
|
||||
|
||||
}
|
||||
|
||||
public ParticipantViewModel(IRepository<Participant> repo, IMethodSharingService<Participant> sharingService) : base()
|
||||
public ParticipantViewModel(
|
||||
IRepository<Participant> repo,
|
||||
IMethodSharingService<Participant> sharingService,
|
||||
AppShellViewModel appShell,
|
||||
IObjectMessageService objectMessage) : base()
|
||||
{
|
||||
_Repository = repo;
|
||||
_sharingService = sharingService;
|
||||
_appShell = appShell;
|
||||
_objectMessage = objectMessage;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -26,6 +33,8 @@ public class ParticipantViewModel : ViewModelBase
|
||||
private ObservableCollection<Participant> _ParticipantList = new();
|
||||
private readonly IRepository<Participant>? _Repository;
|
||||
private readonly IMethodSharingService<Participant> _sharingService;
|
||||
private readonly AppShellViewModel _appShell;
|
||||
private readonly IObjectMessageService _objectMessage;
|
||||
#endregion
|
||||
|
||||
#region public Properties
|
||||
@ -55,6 +64,10 @@ public class ParticipantViewModel : ViewModelBase
|
||||
#region Get Method
|
||||
public ObservableCollection<Participant> Get()
|
||||
{
|
||||
if (_appShell.RoundRunningVisible == false)
|
||||
{
|
||||
_objectMessage.Delivered = true;
|
||||
}
|
||||
ParticipantList = _sharingService.Get();
|
||||
return ParticipantList;
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Common.Library;
|
||||
using GreadyPoang.Core;
|
||||
using GreadyPoang.DataLayer;
|
||||
using GreadyPoang.EntityLayer;
|
||||
using GreadyPoang.Services;
|
||||
@ -22,7 +23,9 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
IRepository<GamePoint> pointsRepo,
|
||||
IMethodSharingService<Participant> sharingService,
|
||||
ICombinedRepository combined,
|
||||
IObjectMessageService objectMessage
|
||||
IObjectMessageService objectMessage,
|
||||
ISplashService splashService,
|
||||
AppShellViewModel appShell
|
||||
) : base()
|
||||
{
|
||||
_roundsRepo = roundsRepo;
|
||||
@ -30,16 +33,23 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
_sharingService = sharingService;
|
||||
_combined = combined;
|
||||
_objectMessage = objectMessage;
|
||||
_splashService = splashService;
|
||||
_appShell = appShell;
|
||||
_roundElements = new ObservableCollection<RoundBuilderElement>();
|
||||
_builderObject = new();
|
||||
_SplashShowing = false;
|
||||
|
||||
}
|
||||
|
||||
private bool _SplashShowing;
|
||||
|
||||
private readonly IRepository<GameRound>? _roundsRepo;
|
||||
private readonly IRepository<GamePoint> _pointsRepo;
|
||||
private readonly IMethodSharingService<Participant> _sharingService;
|
||||
private readonly ICombinedRepository _combined;
|
||||
private readonly IObjectMessageService _objectMessage;
|
||||
|
||||
private readonly ISplashService _splashService;
|
||||
private readonly AppShellViewModel _appShell;
|
||||
private ObservableCollection<RoundBuilderGroup> _GameRoundList = new();
|
||||
private ObservableCollection<Participant> _ParticipantList = new();
|
||||
private ObservableCollection<RoundBuilderElement> _roundElements;
|
||||
@ -52,6 +62,7 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
RebuildRequested?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
// Översta raden
|
||||
public ObservableCollection<RoundBuilderElement> RoundElements
|
||||
{
|
||||
get { return _roundElements; }
|
||||
@ -62,6 +73,7 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
// Nedersta strukturen
|
||||
public Collection<PlayerColumn> PlayerColumns
|
||||
{
|
||||
get { return _playerColumns; }
|
||||
@ -82,13 +94,30 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
private bool _gobackVisible = true;
|
||||
|
||||
public bool GobackVisible
|
||||
{
|
||||
get { return _gobackVisible; }
|
||||
set
|
||||
{
|
||||
_gobackVisible = value;
|
||||
RaisePropertyChanged(nameof(GobackVisible));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public ObservableCollection<RoundBuilderElement> Get()
|
||||
{
|
||||
|
||||
//_overlay.ShowSplash("Laddar...", 30);
|
||||
|
||||
if (_objectMessage.CurrentGroup != null)
|
||||
{
|
||||
GobackVisible = _objectMessage.Delivered;
|
||||
_objectMessage.Delivered = false;
|
||||
//CurrentGroup är satt från RoundStarting ViewModel
|
||||
Debug.WriteLine($"Chosen round: {_objectMessage.CurrentGroup.GameRoundId}");
|
||||
if (RoundElements.Count > 0)
|
||||
@ -97,7 +126,7 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
}
|
||||
foreach (var item in _objectMessage.CurrentGroup.Elements)
|
||||
{
|
||||
_roundElements.Add(item);
|
||||
RoundElements.Add(item);
|
||||
}
|
||||
|
||||
// Räkna ut vem som är nästa spelare
|
||||
@ -113,6 +142,10 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
var localElements = _combined.roundBuilderElementsTotalById(_objectMessage.CurrentGroup.GameRoundId);
|
||||
|
||||
FillupResultTable(localElements);
|
||||
foreach (var col in _playerColumns)
|
||||
{
|
||||
RoundElements.FirstOrDefault(e => e.ParticipantId == col.PlayerId).GameRegPoints = col.PlayerPoints;
|
||||
}
|
||||
TriggerRebuild();
|
||||
}
|
||||
return RoundElements;
|
||||
@ -181,8 +214,6 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void FillupResultTable(IEnumerable<RoundBuilderElement> elements)
|
||||
{
|
||||
if (_playerColumns != null)
|
||||
@ -217,6 +248,11 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
{
|
||||
player.Values.Add(element.GameRegPoints.ToString());
|
||||
player.PlayerPoints += element.GameRegPoints;
|
||||
if (player.PlayerPoints > 10000)
|
||||
{
|
||||
var winner = RoundElements.FirstOrDefault(e => e.ParticipantId == player.PlayerId);
|
||||
winner.Status = GamePointStatus.Winning;
|
||||
}
|
||||
}
|
||||
//oldPart = element.ParticipantId;
|
||||
|
||||
@ -247,6 +283,27 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
public async void ToggleSplash()
|
||||
{
|
||||
|
||||
if (!_SplashShowing)
|
||||
{
|
||||
//_overlay.ShowSplash("Clcicked!", 5000);
|
||||
await _splashService.ShowSplash("Clicked", 0);
|
||||
_SplashShowing = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
await _splashService.HideAsync();
|
||||
_SplashShowing = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void GobackAsync()
|
||||
{
|
||||
_appShell.RoundRunningVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Common.Library;
|
||||
using GreadyPoang.Core;
|
||||
using GreadyPoang.DataLayer;
|
||||
using GreadyPoang.EntityLayer;
|
||||
using GreadyPoang.Services;
|
||||
@ -12,7 +13,6 @@ public class RoundStartingViewModel : ViewModelBase
|
||||
#region Constructors
|
||||
public RoundStartingViewModel() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public RoundStartingViewModel(
|
||||
@ -20,13 +20,22 @@ public class RoundStartingViewModel : ViewModelBase
|
||||
IRepository<GamePoint> pointsRepo,
|
||||
IMethodSharingService<Participant> sharingService,
|
||||
ICombinedRepository combined,
|
||||
IObjectMessageService objectMessage) : base()
|
||||
IObjectMessageService objectMessage,
|
||||
INavigationService nav,
|
||||
IPageFactory factory,
|
||||
ISplashService splashService,
|
||||
AppShellViewModel appShellView
|
||||
) : base()
|
||||
{
|
||||
_roundsRepo = roundsRepo;
|
||||
_pointsRepo = pointsRepo;
|
||||
_sharingService = sharingService;
|
||||
_combined = combined;
|
||||
_objectMessage = objectMessage;
|
||||
_nav = nav;
|
||||
_factory = factory;
|
||||
_splashService = splashService;
|
||||
_appShellView = appShellView;
|
||||
_roundElements = new ObservableCollection<RoundBuilderElement>();
|
||||
}
|
||||
|
||||
@ -40,6 +49,10 @@ public class RoundStartingViewModel : ViewModelBase
|
||||
private readonly IMethodSharingService<Participant> _sharingService;
|
||||
private readonly ICombinedRepository _combined;
|
||||
private readonly IObjectMessageService _objectMessage;
|
||||
private readonly INavigationService _nav;
|
||||
private readonly IPageFactory _factory;
|
||||
private readonly ISplashService _splashService;
|
||||
private readonly AppShellViewModel _appShellView;
|
||||
private Participant _selectedItem;
|
||||
|
||||
private ObservableCollection<RoundBuilderElement> _roundElements;
|
||||
@ -232,17 +245,25 @@ public class RoundStartingViewModel : ViewModelBase
|
||||
RoundElements.Clear();
|
||||
}
|
||||
|
||||
public void RoundSelected(RoundBuilderElement element)
|
||||
public async void RoundSelected(RoundBuilderElement element)
|
||||
{
|
||||
var rbGroup = GameRoundList.FirstOrDefault(g => g.GameRoundId == element.GameRoundId);
|
||||
Debug.WriteLine($"Du valde raden med Runda {element.GameRoundId} och spelare: {element.ParticipantName}");
|
||||
if (rbGroup != null)
|
||||
{
|
||||
_objectMessage.CurrentGroup = rbGroup;
|
||||
Shell.Current.GoToAsync("//RoundRunningView");
|
||||
_objectMessage.Delivered = true;
|
||||
//await _splashService.ShowSplash("Runda vald, gå till\r\r 'Påbörja eller fortsätt Runda'", 3000);
|
||||
await Shell.Current.GoToAsync("RoundRunningPage");
|
||||
|
||||
_appShellView.RoundRunningVisible = false;
|
||||
//_roundRunning.GobackVisible = false;
|
||||
//var page = _factory.CreateRoundPage();
|
||||
//_nav.NavigateToPageAsync(page);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SelectNewlyAddedParticipant(RoundBuilderElement roundBuilder)
|
||||
{
|
||||
Debug.WriteLine($"Du valde raden med Runda {roundBuilder.GameRoundId} och spelare: {roundBuilder.ParticipantName}");
|
||||
|
||||
103
GreadyPoang.ViewModelLayer/ViewModelClasses/SplashViewModel.cs
Normal file
103
GreadyPoang.ViewModelLayer/ViewModelClasses/SplashViewModel.cs
Normal file
@ -0,0 +1,103 @@
|
||||
using Common.Library;
|
||||
|
||||
namespace GreadyPoang.ViewModelLayer;
|
||||
|
||||
public class SplashViewModel : ViewModelBase
|
||||
{
|
||||
// public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private Color _splashBackgroundColor = Colors.DarkSlateBlue;
|
||||
public Color SplashBackgroundColor
|
||||
{
|
||||
get => _splashBackgroundColor;
|
||||
set
|
||||
{
|
||||
_splashBackgroundColor = value;
|
||||
RaisePropertyChanged(nameof(SplashBackgroundColor));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool _isSplashVisible = false;
|
||||
public bool IsSplashVisible
|
||||
{
|
||||
get => _isSplashVisible;
|
||||
set
|
||||
{
|
||||
_isSplashVisible = value;
|
||||
RaisePropertyChanged(nameof(IsSplashVisible));
|
||||
}
|
||||
}
|
||||
|
||||
private double _splashOpacity = 1.0;
|
||||
public double SplashOpacity
|
||||
{
|
||||
get => _splashOpacity;
|
||||
set
|
||||
{
|
||||
_splashOpacity = value;
|
||||
RaisePropertyChanged(nameof(SplashOpacity));
|
||||
}
|
||||
}
|
||||
|
||||
private Color _splashTextColor = Colors.White;
|
||||
|
||||
public Color SplashTextColor
|
||||
{
|
||||
get { return _splashTextColor; }
|
||||
set
|
||||
{
|
||||
_splashTextColor = value;
|
||||
RaisePropertyChanged(nameof(SplashTextColor));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private double _splashTranslationY = 0;
|
||||
public double SplashTranslationY
|
||||
{
|
||||
get => _splashTranslationY;
|
||||
set
|
||||
{
|
||||
_splashTranslationY = value;
|
||||
RaisePropertyChanged(nameof(SplashTranslationY));
|
||||
}
|
||||
}
|
||||
|
||||
public async Task HideSplashAsync()
|
||||
{
|
||||
await Task.Delay(1000); // Simulera laddning
|
||||
await AnimateSplashOut();
|
||||
IsSplashVisible = false;
|
||||
}
|
||||
|
||||
private string _splashText = "Välkommen!";
|
||||
public string SplashText
|
||||
{
|
||||
get => _splashText;
|
||||
set
|
||||
{
|
||||
_splashText = value;
|
||||
RaisePropertyChanged(nameof(SplashText));
|
||||
}
|
||||
}
|
||||
|
||||
//public Color SplashBackgroundColor { get; set; } = Colors.DarkSlateBlue;
|
||||
//public string SplashImage { get; set; } = "splash_icon.png";
|
||||
|
||||
//protected void OnPropertyChanged(string name) =>
|
||||
// PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||
|
||||
|
||||
|
||||
|
||||
private async Task AnimateSplashOut()
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
SplashOpacity -= 0.1;
|
||||
//SplashTranslationY += 5;
|
||||
await Task.Delay(30);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36408.4
|
||||
VisualStudioVersion = 17.14.36518.9 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreadyPoang", "GreadyPoang\GreadyPoang.csproj", "{B237F7D6-3B04-49AE-81B0-FEFE21A94CA7}"
|
||||
EndProject
|
||||
|
||||
@ -1,18 +1,38 @@
|
||||
using GreadyPoang.DataLayer.Database;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace GreadyPoang
|
||||
namespace GreadyPoang;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
public App(DataContext dataContext)
|
||||
private readonly IServiceProvider _services;
|
||||
|
||||
public App(IServiceProvider services, DataContext dataContext)
|
||||
{
|
||||
InitializeComponent();
|
||||
dataContext.Database.EnsureCreated();
|
||||
_services = services;
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
|
||||
{
|
||||
if (Debugger.IsAttached)
|
||||
Debugger.Break();
|
||||
};
|
||||
|
||||
TaskScheduler.UnobservedTaskException += (sender, e) =>
|
||||
{
|
||||
if (Debugger.IsAttached)
|
||||
Debugger.Break();
|
||||
};
|
||||
}
|
||||
|
||||
protected override Window CreateWindow(IActivationState? activationState)
|
||||
{
|
||||
return new Window(new AppShell());
|
||||
}
|
||||
|
||||
//var splashVm = ServiceLocator.Services.GetRequiredService<SplashViewModelCommands>();
|
||||
//var shell = new AppShell(splashVm);
|
||||
|
||||
var shell = _services.GetRequiredService<AppShell>();
|
||||
return new Window(shell);
|
||||
}
|
||||
}
|
||||
@ -3,28 +3,28 @@
|
||||
x:Class="GreadyPoang.AppShell"
|
||||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:vm ="clr-namespace:GreadyPoang.ViewModelLayer;assembly=GreadyPoang.ViewModelLayer"
|
||||
xmlns:views="clr-namespace:GreadyPoang.Views"
|
||||
xmlns:pages="clr-namespace:GreadyPoang.Pages"
|
||||
xmlns:local="clr-namespace:GreadyPoang"
|
||||
Title="GreadyPoang"
|
||||
Shell.TitleColor="LightYellow"
|
||||
x:DataType="vm:AppShellViewModel"
|
||||
Shell.BackgroundColor="CadetBlue">
|
||||
|
||||
<TabBar>
|
||||
<ShellContent
|
||||
Title="Home"
|
||||
ContentTemplate="{DataTemplate local:MainPage}"
|
||||
Title="Home" ContentTemplate="{DataTemplate local:MainPage}"
|
||||
Route="MainPage" />
|
||||
<ShellContent
|
||||
Title="Deltagare"
|
||||
ContentTemplate="{DataTemplate views:ParticipantListView}"
|
||||
Route="ParticipantListView" />
|
||||
Title="Deltagare" ContentTemplate="{DataTemplate pages:ParticipantListPage}"
|
||||
Route="ParticipantListPage"/>
|
||||
<ShellContent
|
||||
Title="Starta Ny Runda"
|
||||
ContentTemplate="{DataTemplate views:RoundStartingView}"
|
||||
Route="RoundStartingView" />
|
||||
Title="Ny Runda" ContentTemplate="{DataTemplate pages:RoundStartingPage}"
|
||||
Route="RoundStartingPage"/>
|
||||
<ShellContent
|
||||
Title="Påbörja eller fortsätt Runda"
|
||||
ContentTemplate="{DataTemplate views:RoundRunningView}"
|
||||
Route="RoundRunningView" />
|
||||
Title="Påbörja eller fortsätt Runda" ContentTemplate="{DataTemplate pages:RoundRunningPage}"
|
||||
Route="RoundRunningPage" IsVisible="{Binding RoundRunningVisible}"/>
|
||||
</TabBar>
|
||||
|
||||
</Shell>
|
||||
|
||||
@ -1,10 +1,21 @@
|
||||
namespace GreadyPoang
|
||||
using GreadyPoang.Core;
|
||||
using GreadyPoang.ViewModelLayer;
|
||||
|
||||
namespace GreadyPoang
|
||||
{
|
||||
public partial class AppShell : Shell
|
||||
{
|
||||
public AppShell()
|
||||
private readonly IPageFactory _factory;
|
||||
|
||||
public AppShell(IPageFactory factory, AppShellViewModel appShellView)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Routing.RegisterRoute("RoundStartingPage", typeof(Pages.RoundStartingPage));
|
||||
Routing.RegisterRoute("ParticipantListPage", typeof(Pages.ParticipantListPage));
|
||||
Routing.RegisterRoute("RoundRunningPage", typeof(Pages.RoundRunningPage));
|
||||
_factory = factory;
|
||||
BindingContext = appShellView;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
40
GreadyPoang/BasePage.xaml
Normal file
40
GreadyPoang/BasePage.xaml
Normal file
@ -0,0 +1,40 @@
|
||||
<?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"
|
||||
x:Class="GreadyPoang.BasePage"
|
||||
xmlns:viewsPartial="clr-namespace:GreadyPoang.ViewsPartial"
|
||||
x:Name="Root">
|
||||
<AbsoluteLayout>
|
||||
<!-- Huvudinnehåll -->
|
||||
<ContentView x:Name="MainContent"
|
||||
AbsoluteLayout.LayoutBounds="0,0,1,1"
|
||||
AbsoluteLayout.LayoutFlags="All" />
|
||||
|
||||
<!-- Overlay: Splash -->
|
||||
<viewsPartial:SplashView
|
||||
AbsoluteLayout.LayoutBounds="0,0,1,1"
|
||||
AbsoluteLayout.LayoutFlags="All"
|
||||
x:Name="SplashView"
|
||||
IsVisible="True"
|
||||
Opacity="1"
|
||||
ZIndex="999"
|
||||
TranslationY="{Binding SplashTranslationY}"
|
||||
InputTransparent="True" >
|
||||
</viewsPartial:SplashView>
|
||||
|
||||
<!--
|
||||
WidthRequest="250"
|
||||
HeightRequest="150"
|
||||
IsVisible="{Binding IsSplashVisible}"
|
||||
BackgroundColor="{Binding SplashBackgroundColor}"
|
||||
x:Name="SplashView"
|
||||
BackgroundColor="Black"
|
||||
Opacity="{Binding SplashOpacity}"
|
||||
IsVisible="True"
|
||||
Opacity="0.9"
|
||||
ZIndex="999"
|
||||
BackgroundColor="Black" />-->
|
||||
|
||||
|
||||
</AbsoluteLayout>
|
||||
</ContentPage>
|
||||
13
GreadyPoang/BasePage.xaml.cs
Normal file
13
GreadyPoang/BasePage.xaml.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using GreadyPoang.CommandClasses;
|
||||
|
||||
namespace GreadyPoang;
|
||||
|
||||
public partial class BasePage : ContentPage
|
||||
{
|
||||
public BasePage(View content, SplashViewModelCommands splashVm)
|
||||
{
|
||||
InitializeComponent();
|
||||
MainContent.Content = content;
|
||||
SplashView.BindingContext = splashVm;
|
||||
}
|
||||
}
|
||||
11
GreadyPoang/CommandClasses/AppShellViewModelCommands.cs
Normal file
11
GreadyPoang/CommandClasses/AppShellViewModelCommands.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using GreadyPoang.ViewModelLayer;
|
||||
|
||||
namespace GreadyPoang.CommandClasses;
|
||||
|
||||
public class AppShellViewModelCommands : AppShellViewModel
|
||||
{
|
||||
public AppShellViewModelCommands() : base()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
15
GreadyPoang/CommandClasses/MainPageViewModelCommands.cs
Normal file
15
GreadyPoang/CommandClasses/MainPageViewModelCommands.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using GreadyPoang.Services;
|
||||
using GreadyPoang.ViewModelLayer;
|
||||
|
||||
namespace GreadyPoang.CommandClasses;
|
||||
|
||||
public class MainPageViewModelCommands : MainPageViewModel
|
||||
{
|
||||
public MainPageViewModelCommands(
|
||||
AppShellViewModel appShell,
|
||||
IObjectMessageService messageService
|
||||
) : base(appShell, messageService)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,10 @@
|
||||
using Common.Library;
|
||||
using GreadyPoang.EntityLayer;
|
||||
using GreadyPoang.Services;
|
||||
using GreadyPoang.ViewModelLayer;
|
||||
using System.Windows.Input;
|
||||
|
||||
|
||||
namespace GreadyPoang.CommandClasses;
|
||||
|
||||
public class ParticipantViewModelCommands : ParticipantViewModel
|
||||
@ -10,9 +12,13 @@ public class ParticipantViewModelCommands : ParticipantViewModel
|
||||
#region constructors
|
||||
public ParticipantViewModelCommands() : base()
|
||||
{
|
||||
|
||||
}
|
||||
public ParticipantViewModelCommands(IRepository<Participant> repo, IMethodSharingService<Participant> sharingService) : base(repo, sharingService)
|
||||
|
||||
public ParticipantViewModelCommands(
|
||||
IRepository<Participant> repo,
|
||||
IMethodSharingService<Participant> sharingService,
|
||||
AppShellViewModel appShell,
|
||||
IObjectMessageService objectMessage) : base(repo, sharingService, appShell, objectMessage)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Common.Library;
|
||||
using GreadyPoang.Core;
|
||||
using GreadyPoang.DataLayer;
|
||||
using GreadyPoang.EntityLayer;
|
||||
using GreadyPoang.Services;
|
||||
@ -18,22 +19,23 @@ public class RoundRunningViewModelCommands : RoundRunningViewModel
|
||||
IRepository<GamePoint> pointsRepo,
|
||||
IMethodSharingService<Participant> sharingService,
|
||||
ICombinedRepository combined,
|
||||
IObjectMessageService objectMessage)
|
||||
IObjectMessageService objectMessage,
|
||||
ISplashService splashService,
|
||||
AppShellViewModel appShell)
|
||||
: base(roundsRepo,
|
||||
pointsRepo,
|
||||
sharingService,
|
||||
combined,
|
||||
objectMessage)
|
||||
objectMessage,
|
||||
splashService,
|
||||
appShell)
|
||||
{
|
||||
}
|
||||
|
||||
#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 GobackCommand { get; private set; }
|
||||
public ICommand StoreAndHandlePointsCommand { get; private set; }
|
||||
public ICommand OnSplashClickedCommand { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -41,16 +43,25 @@ public class RoundRunningViewModelCommands : RoundRunningViewModel
|
||||
{
|
||||
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));
|
||||
OnSplashClickedCommand = new Command(async () => await ToggleSplash());
|
||||
GobackCommand = new Command(async () => GobackAsync());
|
||||
}
|
||||
|
||||
private async void GobackAsync()
|
||||
{
|
||||
base.GobackAsync();
|
||||
await Shell.Current.GoToAsync("..");
|
||||
}
|
||||
|
||||
private async Task StoreAndHandleAsync()
|
||||
{
|
||||
base.StoreAndHandlePoints();
|
||||
await Shell.Current.GoToAsync("..");
|
||||
//await Shell.Current.GoToAsync("..");
|
||||
// await Shell.Current.GoToAsync("RoundRunningPage");
|
||||
}
|
||||
|
||||
private async Task ToggleSplash()
|
||||
{
|
||||
base.ToggleSplash();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Common.Library;
|
||||
using GreadyPoang.Core;
|
||||
using GreadyPoang.DataLayer;
|
||||
using GreadyPoang.EntityLayer;
|
||||
using GreadyPoang.Services;
|
||||
@ -18,12 +19,20 @@ public class RoundStartingViewModelCommands : RoundStartingViewModel
|
||||
IRepository<GamePoint> pointsRepo,
|
||||
IMethodSharingService<Participant> sharingService,
|
||||
ICombinedRepository combined,
|
||||
IObjectMessageService objectMessage)
|
||||
IObjectMessageService objectMessage,
|
||||
INavigationService nav,
|
||||
IPageFactory factory,
|
||||
ISplashService splashService,
|
||||
AppShellViewModel appShell)
|
||||
: base(roundsRepo,
|
||||
pointsRepo,
|
||||
sharingService,
|
||||
combined,
|
||||
objectMessage)
|
||||
objectMessage,
|
||||
nav,
|
||||
factory,
|
||||
splashService,
|
||||
appShell)
|
||||
{
|
||||
}
|
||||
|
||||
@ -101,7 +110,6 @@ public class RoundStartingViewModelCommands : RoundStartingViewModel
|
||||
base.SelectNewlyAddedParticipant(roundBuilder);
|
||||
goneOk = true;
|
||||
return goneOk;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
10
GreadyPoang/CommandClasses/SplashViewModelCommands.cs
Normal file
10
GreadyPoang/CommandClasses/SplashViewModelCommands.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using GreadyPoang.ViewModelLayer;
|
||||
|
||||
namespace GreadyPoang.CommandClasses;
|
||||
|
||||
public class SplashViewModelCommands : SplashViewModel
|
||||
{
|
||||
public SplashViewModelCommands() : base()
|
||||
{
|
||||
}
|
||||
}
|
||||
11
GreadyPoang/Core/NavigationService.cs
Normal file
11
GreadyPoang/Core/NavigationService.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace GreadyPoang.Core;
|
||||
|
||||
public class NavigationService : INavigationService
|
||||
{
|
||||
|
||||
public Task NavigateToAsync(string route)
|
||||
=> Shell.Current.GoToAsync(route);
|
||||
|
||||
public Task NavigateToPageAsync(Page page)
|
||||
=> Shell.Current.Navigation.PushAsync(page);
|
||||
}
|
||||
30
GreadyPoang/Core/PageFactory.cs
Normal file
30
GreadyPoang/Core/PageFactory.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using GreadyPoang.CommandClasses;
|
||||
using GreadyPoang.Core;
|
||||
using GreadyPoang.Pages;
|
||||
|
||||
namespace GreadyPoang;
|
||||
|
||||
public class PageFactory : IPageFactory
|
||||
{
|
||||
private readonly IServiceProvider _services;
|
||||
|
||||
public PageFactory(IServiceProvider services)
|
||||
{
|
||||
_services = services;
|
||||
}
|
||||
|
||||
public Page CreateRoundPage()
|
||||
{
|
||||
var vm = _services.GetRequiredService<RoundRunningViewModelCommands>();
|
||||
var splashVm = _services.GetRequiredService<SplashViewModelCommands>();
|
||||
return new RoundRunningPage(vm, splashVm);
|
||||
}
|
||||
|
||||
//public Page CreateStatsPage()
|
||||
//{
|
||||
// //var vm = _services.GetRequiredService<StatsViewModel>();
|
||||
// //var splashVm = _services.GetRequiredService<SplashViewModelCommands>();
|
||||
// //var view = new StatsView { BindingContext = vm };
|
||||
// //return new StatsPage(view, splashVm);
|
||||
//}
|
||||
}
|
||||
10
GreadyPoang/Core/ServiceLocator.cs
Normal file
10
GreadyPoang/Core/ServiceLocator.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using GreadyPoang.InterFaces;
|
||||
|
||||
namespace GreadyPoang;
|
||||
|
||||
public class ServiceLocator : IServiceLocator
|
||||
{
|
||||
public static IServiceProvider? Services { get; set; } = default;
|
||||
public T Get<T>() => (T)Services!.GetService(typeof(T))!;
|
||||
|
||||
}
|
||||
@ -70,7 +70,7 @@
|
||||
<ProjectReference Include="..\GreadyPoang.Common\GreadyPoang.Common.csproj" />
|
||||
<ProjectReference Include="..\GreadyPoang.DataLayer\GreadyPoang.DataLayer.csproj" />
|
||||
<ProjectReference Include="..\GreadyPoang.EntityLayer\GreadyPoang.EntityLayer.csproj" />
|
||||
<ProjectReference Include="..\GreadyPoang.Services\GreadyPoang.Services.csproj" />
|
||||
<!--<ProjectReference Include="..\GreadyPoang.Services\GreadyPoang.Services.csproj" />-->
|
||||
<ProjectReference Include="..\GreadyPoang.ViewModelLayer\GreadyPoang.ViewModelLayer.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -81,6 +81,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<MauiXaml Update="BasePage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
<MauiXaml Update="Resources\Styles\AppStyles.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
@ -96,6 +99,9 @@
|
||||
<MauiXaml Update="Views\RoundStartingView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
<MauiXaml Update="ViewsPartial\SplashView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
12
GreadyPoang/InterFaces/IServiceLocator.cs
Normal file
12
GreadyPoang/InterFaces/IServiceLocator.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GreadyPoang.InterFaces;
|
||||
|
||||
public interface IServiceLocator
|
||||
{
|
||||
T Get<T>();
|
||||
}
|
||||
34
GreadyPoang/LocalServices/Implements/SplashService.cs
Normal file
34
GreadyPoang/LocalServices/Implements/SplashService.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using GreadyPoang.CommandClasses;
|
||||
using GreadyPoang.Core;
|
||||
|
||||
namespace GreadyPoang.LocalServices;
|
||||
|
||||
public class SplashService : ISplashService
|
||||
{
|
||||
private readonly SplashViewModelCommands _viewModel;
|
||||
|
||||
public SplashService(SplashViewModelCommands viewModel)
|
||||
{
|
||||
_viewModel = viewModel;
|
||||
}
|
||||
|
||||
public async Task ShowSplash(string text = "Välkommen!", int durationMs = 3000)
|
||||
{
|
||||
_viewModel.SplashText = text;
|
||||
_viewModel.SplashOpacity = 0.8;
|
||||
_viewModel.SplashBackgroundColor = Colors.DodgerBlue;
|
||||
_viewModel.IsSplashVisible = true;
|
||||
//await Task.Yield(); // ger UI-tråden en chans att uppdatera
|
||||
if (durationMs > 0)
|
||||
{
|
||||
await Task.Delay(durationMs);
|
||||
_viewModel.IsSplashVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task HideAsync()
|
||||
{
|
||||
//_viewModel.IsSplashVisible = false;
|
||||
await _viewModel.HideSplashAsync();
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,8 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:partial="clr-namespace:GreadyPoang.ViewsPartial"
|
||||
x:Class="GreadyPoang.MainPage"
|
||||
xmlns:vm ="clr-namespace:GreadyPoang.CommandClasses"
|
||||
x:DataType="vm:MainPageViewModelCommands"
|
||||
Background="LightCyan"
|
||||
Title="{StaticResource ApplicationTitle}">
|
||||
<Grid Style="{StaticResource Grid.Page}">
|
||||
@ -12,7 +14,8 @@
|
||||
ViewDescription="Välkommen till Gready">
|
||||
|
||||
</partial:HeaderView>
|
||||
<Image Source="snurrtarning.gif"
|
||||
<Image
|
||||
Source="snurrtarning.gif"
|
||||
IsAnimationPlaying="True"
|
||||
HorizontalOptions="Center"
|
||||
VerticalOptions="Center"
|
||||
|
||||
@ -1,11 +1,23 @@
|
||||
namespace GreadyPoang;
|
||||
using GreadyPoang.CommandClasses;
|
||||
|
||||
namespace GreadyPoang;
|
||||
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
private readonly MainPageViewModelCommands _mainPage;
|
||||
|
||||
public MainPage()
|
||||
public MainPage(
|
||||
MainPageViewModelCommands mainPage)
|
||||
{
|
||||
InitializeComponent();
|
||||
BindingContext = mainPage;
|
||||
_mainPage = mainPage;
|
||||
}
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
_mainPage.InitMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
using Common.Library;
|
||||
using GreadyPoang.CommandClasses;
|
||||
using GreadyPoang.Core;
|
||||
using GreadyPoang.DataLayer;
|
||||
using GreadyPoang.DataLayer.Database;
|
||||
using GreadyPoang.EntityLayer;
|
||||
using GreadyPoang.InterFaces;
|
||||
using GreadyPoang.LocalServices;
|
||||
using GreadyPoang.Services;
|
||||
using GreadyPoang.ViewModelLayer;
|
||||
using GreadyPoang.Views;
|
||||
@ -38,6 +41,10 @@ public static class MauiProgram
|
||||
options.UseSqlite($"Data Source={dbPath}");
|
||||
});
|
||||
|
||||
builder.Services.AddScoped<IPageFactory, PageFactory>();
|
||||
builder.Services.AddSingleton<INavigationService, NavigationService>();
|
||||
builder.Services.AddSingleton<IServiceLocator, ServiceLocator>();
|
||||
|
||||
builder.Services.AddScoped<IRepository<Participant>, ParticipantRepository>();
|
||||
builder.Services.AddScoped<ParticipantViewModelCommands>();
|
||||
builder.Services.AddScoped<ParticipantListView>();
|
||||
@ -46,22 +53,29 @@ public static class MauiProgram
|
||||
builder.Services.AddScoped<RoundStartingViewModelCommands>();
|
||||
builder.Services.AddScoped<RoundStartingView>();
|
||||
|
||||
builder.Services.AddSingleton<IObjectMessageService, ObjectMessageService>();
|
||||
|
||||
builder.Services.AddScoped<IRepository<GamePoint>, GamePointRepository>();
|
||||
builder.Services.AddScoped<RoundRunningViewModelCommands>();
|
||||
builder.Services.AddScoped<RoundRunningView>();
|
||||
|
||||
builder.Services.AddScoped<IRepository<GamePoint>, GamePointRepository>();
|
||||
|
||||
|
||||
builder.Services.AddScoped<IMethodSharingService<Participant>, MethodSharingService>();
|
||||
|
||||
builder.Services.AddScoped<ICombinedRepository, CombinedRepository>();
|
||||
|
||||
builder.Services.AddSingleton<IObjectMessageService, ObjectMessageService>();
|
||||
|
||||
builder.Services.AddSingleton<AppShellViewModel>();
|
||||
builder.Services.AddSingleton<AppShell>();
|
||||
|
||||
builder.Services.AddSingleton<SplashViewModelCommands>();
|
||||
builder.Services.AddSingleton<ISplashService, SplashService>();
|
||||
|
||||
builder.Services.AddSingleton<MainPageViewModelCommands>();
|
||||
|
||||
|
||||
#if DEBUG
|
||||
builder.Logging.AddDebug();
|
||||
#endif
|
||||
|
||||
return builder.Build();
|
||||
var app = builder.Build();
|
||||
ServiceLocator.Services = app.Services;
|
||||
return app;
|
||||
}
|
||||
}
|
||||
|
||||
24
GreadyPoang/Pages/ParticipantListPage.cs
Normal file
24
GreadyPoang/Pages/ParticipantListPage.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using GreadyPoang.CommandClasses;
|
||||
using GreadyPoang.Views;
|
||||
|
||||
namespace GreadyPoang.Pages;
|
||||
|
||||
public class ParticipantListPage : BasePage
|
||||
{
|
||||
private readonly ParticipantViewModelCommands _vm;
|
||||
|
||||
public ParticipantListPage(ParticipantViewModelCommands vm, SplashViewModelCommands splashVm)
|
||||
: base(new ParticipantListView(vm), splashVm)
|
||||
{
|
||||
Title = "Deltagar Lista";
|
||||
_vm = vm;
|
||||
}
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
BindingContext = _vm;
|
||||
_vm.Get();
|
||||
}
|
||||
|
||||
}
|
||||
43
GreadyPoang/Pages/RoundRunningPage.cs
Normal file
43
GreadyPoang/Pages/RoundRunningPage.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using GreadyPoang.CommandClasses;
|
||||
using GreadyPoang.Core;
|
||||
using GreadyPoang.Views;
|
||||
|
||||
namespace GreadyPoang.Pages;
|
||||
|
||||
public class RoundRunningPage : BasePage
|
||||
{
|
||||
private readonly RoundRunningViewModelCommands _vm;
|
||||
private readonly SplashViewModelCommands _splashVm;
|
||||
public ISplashService Splash { get; set; }
|
||||
|
||||
public RoundRunningPage(RoundRunningViewModelCommands Vm, SplashViewModelCommands splashVm)
|
||||
: base(new RoundRunningView(Vm), splashVm)
|
||||
{
|
||||
Title = "Starta/Fortsätt runda";
|
||||
_vm = Vm;
|
||||
Splash = ServiceLocator.Services?.GetRequiredService<ISplashService>();
|
||||
_splashVm = splashVm;
|
||||
}
|
||||
|
||||
|
||||
public SplashViewModelCommands SplashVm { get; }
|
||||
|
||||
protected override async void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
BindingContext = _vm;
|
||||
_vm.Get();
|
||||
//BuildScoreGrid(ViewModel.PlayerColumns); // <-- här bygger du layouten
|
||||
//// _vm.RebuildRequested += ViewModel_RebuildRequested;
|
||||
if (_splashVm != null)
|
||||
{
|
||||
await Splash.ShowSplash("Nu kan du spela vidare", 3000);
|
||||
//await Splash.ShowSplash("Nu kan du spela vidare", 3000).GetAwaiter().GetResult();
|
||||
}
|
||||
//_splashVm.ShowSplash("Nu kan du spela vidare").GetAwaiter().GetResult(); ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
25
GreadyPoang/Pages/RoundStartingPage.cs
Normal file
25
GreadyPoang/Pages/RoundStartingPage.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using GreadyPoang.CommandClasses;
|
||||
using GreadyPoang.Views;
|
||||
|
||||
namespace GreadyPoang.Pages;
|
||||
|
||||
public class RoundStartingPage : BasePage
|
||||
{
|
||||
private readonly RoundStartingViewModelCommands _vm;
|
||||
|
||||
public RoundStartingPage(RoundStartingViewModelCommands vm, SplashViewModelCommands splashVm)
|
||||
: base(new RoundStartingView(vm), splashVm)
|
||||
{
|
||||
Title = "Starta ny Runda";
|
||||
_vm = vm;
|
||||
}
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
BindingContext = _vm;
|
||||
_vm.Get();
|
||||
_vm.GetParticipants();
|
||||
}
|
||||
|
||||
}
|
||||
@ -55,6 +55,12 @@
|
||||
<DataTrigger TargetType="Border" Binding="{Binding Status}" Value="Cancelled">
|
||||
<Setter Property="BackgroundColor" Value="LightCoral" />
|
||||
</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>
|
||||
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:partial="clr-namespace:GreadyPoang.ViewsPartial"
|
||||
xmlns:vm="clr-namespace:GreadyPoang.CommandClasses"
|
||||
xmlns:model="clr-namespace:GreadyPoang.EntityLayer;assembly=GreadyPoang.EntityLayer"
|
||||
x:Class="GreadyPoang.Views.ParticipantListView"
|
||||
x:DataType="vm:ParticipantViewModelCommands"
|
||||
x:Name="ParticipantListPage"
|
||||
Title="Deltagar Lista">
|
||||
x:Name="ParticipantListPage">
|
||||
<!--Title="Deltagar Lista"-->
|
||||
|
||||
<Border Style="{StaticResource Border.Page}" StrokeThickness="4">
|
||||
<Grid Style="{StaticResource Grid.Page}">
|
||||
@ -86,4 +86,4 @@
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ContentPage>
|
||||
</ContentView>
|
||||
@ -2,7 +2,7 @@ using GreadyPoang.CommandClasses;
|
||||
|
||||
namespace GreadyPoang.Views;
|
||||
|
||||
public partial class ParticipantListView : ContentPage
|
||||
public partial class ParticipantListView : ContentView
|
||||
{
|
||||
public ParticipantListView(ParticipantViewModelCommands viewModel)
|
||||
{
|
||||
@ -13,15 +13,12 @@ public partial class ParticipantListView : ContentPage
|
||||
public ParticipantViewModelCommands ViewModel { get; set; }
|
||||
public int ParticipantId { get; set; }
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
BindingContext = ViewModel;
|
||||
ViewModel.Get();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//protected override void OnAppearing()
|
||||
//{
|
||||
// base.OnAppearing();
|
||||
// BindingContext = ViewModel;
|
||||
// ViewModel.Get();
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
<ContentView 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"
|
||||
@ -7,8 +7,8 @@
|
||||
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:RoundRunningViewModelCommands"
|
||||
Title="RoundRunningView">
|
||||
x:DataType="vm:RoundRunningViewModelCommands">
|
||||
<!--Title="RoundRunningView"-->
|
||||
|
||||
<Border Style="{StaticResource Border.Page}" StrokeThickness="4">
|
||||
<Grid Style="{StaticResource Grid.Page}">
|
||||
@ -34,6 +34,7 @@
|
||||
Padding="10"
|
||||
Margin="5"
|
||||
StrokeShape="RoundRectangle 10"
|
||||
BackgroundColor="{Binding OverrideColor}"
|
||||
Style="{StaticResource StatusBorderStyle}">
|
||||
<Border.GestureRecognizers>
|
||||
<TapGestureRecognizer
|
||||
@ -83,8 +84,21 @@
|
||||
</Entry>
|
||||
</Grid>
|
||||
<Button Text="Register Points"
|
||||
WidthRequest="100"
|
||||
Style="{StaticResource HoverButtonRedStyle}"
|
||||
Command="{Binding StoreAndHandlePointsCommand}"/>
|
||||
<VerticalStackLayout >
|
||||
<Button Text="Visa Splash"
|
||||
WidthRequest="100"
|
||||
Style="{StaticResource HoverButtonBlueStyle}"
|
||||
Command="{Binding OnSplashClickedCommand}"/>
|
||||
<Button Text="Återgå"
|
||||
WidthRequest="100"
|
||||
Style="{StaticResource HoverButtonBlueStyle}"
|
||||
Command="{Binding GobackCommand}"
|
||||
IsVisible="{Binding GobackVisible}" />
|
||||
</VerticalStackLayout>
|
||||
|
||||
</HorizontalStackLayout>
|
||||
</Border>
|
||||
<ScrollView Grid.Row="4" Orientation="Horizontal">
|
||||
@ -98,4 +112,4 @@
|
||||
</ScrollView>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ContentPage>
|
||||
</ContentView>
|
||||
@ -3,25 +3,17 @@ using GreadyPoang.EntityLayer;
|
||||
|
||||
namespace GreadyPoang.Views;
|
||||
|
||||
public partial class RoundRunningView : ContentPage
|
||||
public partial class RoundRunningView : ContentView
|
||||
{
|
||||
|
||||
public RoundRunningView(RoundRunningViewModelCommands viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
ViewModel = 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
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
<ContentView 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.RoundStartingView"
|
||||
@ -7,8 +7,8 @@
|
||||
xmlns:local="clr-namespace:GreadyPoang.EntityLayer;assembly=GreadyPoang.EntityLayer"
|
||||
xmlns:model="clr-namespace:GreadyPoang.EntityLayer;assembly=GreadyPoang.EntityLayer"
|
||||
x:DataType="vm:RoundStartingViewModelCommands"
|
||||
x:Name="GameRoundStartingPage"
|
||||
Title="Starta ny Runda">
|
||||
x:Name="GameRoundStartingPage">
|
||||
<!--Title="Starta ny Runda"-->
|
||||
|
||||
|
||||
|
||||
@ -151,4 +151,4 @@
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ContentPage>
|
||||
</ContentView>
|
||||
@ -2,7 +2,7 @@ using GreadyPoang.CommandClasses;
|
||||
|
||||
namespace GreadyPoang.Views;
|
||||
|
||||
public partial class RoundStartingView : ContentPage
|
||||
public partial class RoundStartingView : ContentView
|
||||
{
|
||||
|
||||
|
||||
@ -15,28 +15,24 @@ public partial class RoundStartingView : ContentPage
|
||||
|
||||
public int GameRoundId { get; set; }
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
BindingContext = ViewModel;
|
||||
ViewModel.Get();
|
||||
ViewModel.GetParticipants();
|
||||
}
|
||||
//protected override void OnAppearing()
|
||||
//{
|
||||
// base.OnAppearing();
|
||||
// BindingContext = ViewModel;
|
||||
// ViewModel.Get();
|
||||
// ViewModel.GetParticipants();
|
||||
//}
|
||||
|
||||
protected override void OnSizeAllocated(double width, double height)
|
||||
{
|
||||
base.OnSizeAllocated(width, height);
|
||||
|
||||
if (width < 500)
|
||||
{
|
||||
VisualStateManager.GoToState(ResponsiveStack, "Narrow");
|
||||
System.Diagnostics.Debug.WriteLine($"width={width} ResponsiveStack=Narrow ");
|
||||
}
|
||||
else
|
||||
{
|
||||
VisualStateManager.GoToState(ResponsiveStack, "Wide");
|
||||
System.Diagnostics.Debug.WriteLine($"width={width} ResponsiveStack=Wide ");
|
||||
}
|
||||
if (ResponsiveStack == null || width <= 0)
|
||||
return;
|
||||
|
||||
var state = width < 500 ? "Narrow" : "Wide";
|
||||
VisualStateManager.GoToState(ResponsiveStack, state);
|
||||
System.Diagnostics.Debug.WriteLine($"width={width} ResponsiveStack={state} ");
|
||||
}
|
||||
|
||||
|
||||
|
||||
30
GreadyPoang/ViewsPartial/SplashView.xaml
Normal file
30
GreadyPoang/ViewsPartial/SplashView.xaml
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Views/SplashView.xaml -->
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="GreadyPoang.ViewsPartial.SplashView"
|
||||
xmlns:vm="clr-namespace:GreadyPoang.CommandClasses"
|
||||
x:DataType="vm:SplashViewModelCommands">
|
||||
<!--IsVisible="{Binding IsSplashVisible}">-->
|
||||
|
||||
<Border x:Name="SplashBorder"
|
||||
Stroke="Black"
|
||||
BackgroundColor="{Binding SplashBackgroundColor}"
|
||||
WidthRequest="350"
|
||||
HeightRequest="200"
|
||||
StrokeShape="RoundRectangle 20"
|
||||
Padding="20"
|
||||
IsVisible="{Binding IsSplashVisible}"
|
||||
HorizontalOptions="Center"
|
||||
VerticalOptions="Center"
|
||||
Opacity="{Binding SplashOpacity}">
|
||||
<StackLayout>
|
||||
<!--<Image Source="{Binding SplashImage}" HeightRequest="60" />-->
|
||||
<Label Text="{Binding SplashText}"
|
||||
FontSize="18"
|
||||
HorizontalOptions="Center"
|
||||
VerticalOptions="Center"
|
||||
TextColor="{Binding SplashTextColor}"/>
|
||||
</StackLayout>
|
||||
</Border>
|
||||
</ContentView>
|
||||
18
GreadyPoang/ViewsPartial/SplashView.xaml.cs
Normal file
18
GreadyPoang/ViewsPartial/SplashView.xaml.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using GreadyPoang.CommandClasses;
|
||||
|
||||
namespace GreadyPoang.ViewsPartial;
|
||||
|
||||
public partial class SplashView : ContentView
|
||||
{
|
||||
public SplashView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public SplashViewModelCommands ViewModel
|
||||
{
|
||||
get => (SplashViewModelCommands)BindingContext;
|
||||
set => BindingContext = value;
|
||||
}
|
||||
|
||||
}
|
||||
9
TempProj/GreadyPoang.CommandClasses.old.csproj
Normal file
9
TempProj/GreadyPoang.CommandClasses.old.csproj
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user