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.
40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
using F4SD.Gamification;
|
|
using F4SD.Gamification.Services;
|
|
using System;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Media;
|
|
|
|
namespace FasdDesktopUi.Basics.UserControls.Gamification
|
|
{
|
|
public partial class LevelTracker : UserControl
|
|
{
|
|
public LevelTracker()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private double GetCircumferenceOfCoverEllipse()
|
|
{
|
|
return (2 * Math.PI * (CoverEllipse.Height / 2.0 - CoverEllipse.StrokeThickness / 2.0)) / CoverEllipse.StrokeThickness;
|
|
}
|
|
|
|
protected override void OnInitialized(EventArgs e)
|
|
{
|
|
CoverEllipse.StrokeDashArray = new DoubleCollection() { GetCircumferenceOfCoverEllipse() };
|
|
LevelService.ExperiencePointsChanged += UpdateExperiencePoints;
|
|
|
|
base.OnInitialized(e);
|
|
}
|
|
|
|
private void UpdateExperiencePoints(object sender, LevelEventArgs e)
|
|
{
|
|
LevelValueTextBlock.Text = e.CurrentLevel.ToString();
|
|
double relativeProgress = (double)e.CurrentXp / (double)e.XpRequiredForLevelUp;
|
|
CoverEllipse.StrokeDashOffset = (GetCircumferenceOfCoverEllipse() * relativeProgress) * -1.0;
|
|
|
|
LevelTitelTextBlock.Text = e.LevelTitle;
|
|
XpTextBlock.Text = $"{e.CurrentXp} / {e.XpRequiredForLevelUp} XP";
|
|
}
|
|
}
|
|
}
|