Stor ombearbetning som skall ge splash möjligheter
This commit is contained in:
@ -4,6 +4,7 @@ using GreadyPoang.EntityLayer;
|
||||
using GreadyPoang.Services;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using GreadyPoang.Core;
|
||||
|
||||
namespace GreadyPoang.ViewModelLayer;
|
||||
|
||||
@ -22,7 +23,8 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
IRepository<GamePoint> pointsRepo,
|
||||
IMethodSharingService<Participant> sharingService,
|
||||
ICombinedRepository combined,
|
||||
IObjectMessageService objectMessage
|
||||
IObjectMessageService objectMessage,
|
||||
IOverlayService overlay
|
||||
) : base()
|
||||
{
|
||||
_roundsRepo = roundsRepo;
|
||||
@ -30,6 +32,7 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
_sharingService = sharingService;
|
||||
_combined = combined;
|
||||
_objectMessage = objectMessage;
|
||||
_overlay = overlay;
|
||||
_roundElements = new ObservableCollection<RoundBuilderElement>();
|
||||
_builderObject = new();
|
||||
}
|
||||
@ -39,7 +42,7 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
private readonly IMethodSharingService<Participant> _sharingService;
|
||||
private readonly ICombinedRepository _combined;
|
||||
private readonly IObjectMessageService _objectMessage;
|
||||
|
||||
private readonly IOverlayService _overlay;
|
||||
private ObservableCollection<RoundBuilderGroup> _GameRoundList = new();
|
||||
private ObservableCollection<Participant> _ParticipantList = new();
|
||||
private ObservableCollection<RoundBuilderElement> _roundElements;
|
||||
@ -86,6 +89,7 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
public ObservableCollection<RoundBuilderElement> Get()
|
||||
{
|
||||
|
||||
_overlay.ShowSplash("Laddar...", 3000);
|
||||
|
||||
if (_objectMessage.CurrentGroup != null)
|
||||
{
|
||||
|
||||
@ -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,17 @@ public class RoundStartingViewModel : ViewModelBase
|
||||
IRepository<GamePoint> pointsRepo,
|
||||
IMethodSharingService<Participant> sharingService,
|
||||
ICombinedRepository combined,
|
||||
IObjectMessageService objectMessage) : base()
|
||||
IObjectMessageService objectMessage,
|
||||
INavigationService nav,
|
||||
IPageFactory factory) : base()
|
||||
{
|
||||
_roundsRepo = roundsRepo;
|
||||
_pointsRepo = pointsRepo;
|
||||
_sharingService = sharingService;
|
||||
_combined = combined;
|
||||
_objectMessage = objectMessage;
|
||||
_nav = nav;
|
||||
_factory = factory;
|
||||
_roundElements = new ObservableCollection<RoundBuilderElement>();
|
||||
}
|
||||
|
||||
@ -40,6 +44,8 @@ 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 Participant _selectedItem;
|
||||
|
||||
private ObservableCollection<RoundBuilderElement> _roundElements;
|
||||
@ -239,10 +245,13 @@ public class RoundStartingViewModel : ViewModelBase
|
||||
if (rbGroup != null)
|
||||
{
|
||||
_objectMessage.CurrentGroup = rbGroup;
|
||||
Shell.Current.GoToAsync("//RoundRunningView");
|
||||
//Shell.Current.GoToAsync("//RoundRunningPage");
|
||||
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}");
|
||||
|
||||
@ -0,0 +1,65 @@
|
||||
using Common.Library;
|
||||
|
||||
namespace GreadyPoang.ViewModelLayer;
|
||||
|
||||
public class SplashViewModel : ViewModelBase
|
||||
{
|
||||
// public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private bool _isSplashVisible = true;
|
||||
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 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;
|
||||
}
|
||||
|
||||
public string SplashText { get; set; } = "Välkommen!";
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user