Stor ombearbetning som skall ge splash möjligheter

This commit is contained in:
2025-10-01 08:38:42 +02:00
parent f2403d5cf3
commit f1077febc4
38 changed files with 548 additions and 98 deletions

View File

@ -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);
}
}
}