iFactory.Godot/BITKit/Scripts/UX/UXApplicationService.cs

40 lines
782 B
C#
Raw Normal View History

2023-09-20 11:38:30 +08:00
using Godot;
using System;
using BITKit.Apps;
using Microsoft.Extensions.DependencyInjection;
namespace BITKit;
2023-11-30 00:27:34 +08:00
public partial class UXApplicationService : EntityBehaviour
2023-09-20 11:38:30 +08:00
{
[Export] private Label currentVersionLabel;
[Export] private Label latestVersionLabel;
[Export] private Button downloadLatestButton;
2023-11-30 00:27:34 +08:00
[Inject]
2023-09-20 11:38:30 +08:00
private IApplicationService _service;
public override void OnAwake()
{
downloadLatestButton.Hide();
downloadLatestButton.Pressed += () =>
{
OS.ShellOpen(_service.DownloadLatestUrl);
};
_service.OnClientVersionCheck += x =>
{
currentVersionLabel.Text = x;
};
_service.OnLatestVersionCheck += x =>
{
latestVersionLabel.Text = x;
};
_service.OnDetectedLatestVersion += () =>
{
downloadLatestButton.Show();
};
}
}