Nu fungerar splash, men måste se vidare på övrig sidhantering
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
using Common.Library;
|
||||
using GreadyPoang.Core;
|
||||
using GreadyPoang.DataLayer;
|
||||
using GreadyPoang.EntityLayer;
|
||||
using GreadyPoang.Services;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using GreadyPoang.Core;
|
||||
|
||||
namespace GreadyPoang.ViewModelLayer;
|
||||
|
||||
@ -24,7 +24,8 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
IMethodSharingService<Participant> sharingService,
|
||||
ICombinedRepository combined,
|
||||
IObjectMessageService objectMessage,
|
||||
IOverlayService overlay
|
||||
IOverlayService overlay,
|
||||
ISplashService splashService
|
||||
) : base()
|
||||
{
|
||||
_roundsRepo = roundsRepo;
|
||||
@ -33,16 +34,22 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
_combined = combined;
|
||||
_objectMessage = objectMessage;
|
||||
_overlay = overlay;
|
||||
_splashService = splashService;
|
||||
_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 IOverlayService _overlay;
|
||||
private readonly ISplashService _splashService;
|
||||
private ObservableCollection<RoundBuilderGroup> _GameRoundList = new();
|
||||
private ObservableCollection<Participant> _ParticipantList = new();
|
||||
private ObservableCollection<RoundBuilderElement> _roundElements;
|
||||
@ -89,7 +96,7 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
public ObservableCollection<RoundBuilderElement> Get()
|
||||
{
|
||||
|
||||
_overlay.ShowSplash("Laddar...", 3000);
|
||||
//_overlay.ShowSplash("Laddar...", 30);
|
||||
|
||||
if (_objectMessage.CurrentGroup != null)
|
||||
{
|
||||
@ -251,6 +258,22 @@ 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,19 @@ public class SplashViewModel : ViewModelBase
|
||||
{
|
||||
// public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private bool _isSplashVisible = true;
|
||||
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;
|
||||
@ -28,6 +40,19 @@ public class SplashViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
private Color _splashTextColor = Colors.White;
|
||||
|
||||
public Color SplashTextColor
|
||||
{
|
||||
get { return _splashTextColor; }
|
||||
set
|
||||
{
|
||||
_splashTextColor = value;
|
||||
RaisePropertyChanged(nameof(SplashTextColor));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private double _splashTranslationY = 0;
|
||||
public double SplashTranslationY
|
||||
{
|
||||
@ -46,19 +71,32 @@ public class SplashViewModel : ViewModelBase
|
||||
IsSplashVisible = false;
|
||||
}
|
||||
|
||||
public string SplashText { get; set; } = "Välkommen!";
|
||||
public Color SplashBackgroundColor { get; set; } = Colors.DarkSlateBlue;
|
||||
public string SplashImage { get; set; } = "splash_icon.png";
|
||||
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;
|
||||
//SplashTranslationY += 5;
|
||||
await Task.Delay(30);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user