Files
C4IT-F4SD-Client/FasdDesktopUi/Pages/LevelUpPage/LevelUpPage.xaml.cs
Meik 0b52999b1d feat: expand cockpit integrations and support workflows
Add Phoenix remote desktop, action connector, documentation engine, and gamification support. Refactor support-case processing and search/action UI, and update installer assets and dependencies.
2026-07-13 11:16:53 +02:00

92 lines
3.0 KiB
C#

using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Animation;
namespace FasdDesktopUi.Pages.LevelUpPage
{
public partial class LevelUpPage : Window
{
public int NewLevel
{
get { return (int)GetValue(NewLevelProperty); }
set { SetValue(NewLevelProperty, value); }
}
public static readonly DependencyProperty NewLevelProperty =
DependencyProperty.Register(nameof(NewLevel), typeof(int), typeof(LevelUpPage), new PropertyMetadata(0, new PropertyChangedCallback(HandleLevelChanged)));
private static void HandleLevelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (!(d is LevelUpPage levelupPage))
return;
levelupPage.LastLevelTextBlock.Text = (levelupPage.NewLevel - 1).ToString();
levelupPage.NewLevelTextBlock.Text = levelupPage.NewLevel.ToString();
}
public string LevelTitle
{
get { return (string)GetValue(LevelTitleProperty); }
set { SetValue(LevelTitleProperty, value); }
}
public static readonly DependencyProperty LevelTitleProperty =
DependencyProperty.Register(nameof(LevelTitle), typeof(string), typeof(LevelUpPage), new PropertyMetadata("string.Empty"));
public LevelUpPage()
{
InitializeComponent();
}
private async Task AnimateText()
{
await Task.Delay(900);
double animationDistance = NewLevelTextBlock.ActualHeight + NewLevelTextBlock.Margin.Top + NewLevelTextBlock.Margin.Bottom;
Duration duration = TimeSpan.FromMilliseconds(500);
DoubleAnimation lowerAnimation = new DoubleAnimation
{
From = 0,
To = -animationDistance,
Duration = duration,
EasingFunction = new CubicEase
{
EasingMode = EasingMode.EaseInOut
}
};
DoubleAnimation upperAnimation = new DoubleAnimation
{
From = 0,
To = -animationDistance,
Duration = duration,
EasingFunction = new CubicEase
{
EasingMode = EasingMode.EaseInOut
}
};
LowerTransform.BeginAnimation(TranslateTransform.YProperty, lowerAnimation);
UpperTransform.BeginAnimation(TranslateTransform.YProperty, upperAnimation);
}
private async void HandleVisibilityChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (Visibility != Visibility.Visible)
return;
await AnimateText();
}
private void Continue_Click(object sender, RoutedEventArgs e)
{
Close();
}
}
}