66 lines
1.6 KiB
C#
66 lines
1.6 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|