42 lines
853 B
C#
42 lines
853 B
C#
|
using Godot;
|
||
|
using System;
|
||
|
using BITKit.Apps;
|
||
|
using Microsoft.Extensions.DependencyInjection;
|
||
|
|
||
|
namespace BITKit;
|
||
|
|
||
|
public partial class UXApplicationService : EntityComponent
|
||
|
|
||
|
{
|
||
|
[Export] private Label currentVersionLabel;
|
||
|
[Export] private Label latestVersionLabel;
|
||
|
[Export] private Button downloadLatestButton;
|
||
|
|
||
|
private IApplicationService _service;
|
||
|
public override void OnAwake()
|
||
|
{
|
||
|
_service = Entity.ServiceProvider.GetRequiredService<IApplicationService>();
|
||
|
|
||
|
downloadLatestButton.Hide();
|
||
|
|
||
|
downloadLatestButton.Pressed += () =>
|
||
|
{
|
||
|
OS.ShellOpen(_service.DownloadLatestUrl);
|
||
|
};
|
||
|
|
||
|
_service.OnClientVersionCheck += x =>
|
||
|
{
|
||
|
currentVersionLabel.Text = x;
|
||
|
};
|
||
|
_service.OnLatestVersionCheck += x =>
|
||
|
{
|
||
|
latestVersionLabel.Text = x;
|
||
|
};
|
||
|
_service.OnDetectedLatestVersion += () =>
|
||
|
{
|
||
|
downloadLatestButton.Show();
|
||
|
};
|
||
|
}
|
||
|
|
||
|
}
|