104 lines
2.4 KiB
C#
104 lines
2.4 KiB
C#
using Common.Library;
|
|
|
|
namespace Gready_Poang.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);
|
|
}
|
|
}
|
|
}
|