Files
i2p 773d05f8f1
Pulsar .NET 9.0 Windows Release / build (push) Waiting to run
Mirror to Codeberg and Gitea / mirror (push) Waiting to run
initial commit
2026-08-27 10:57:58 -06:00

48 lines
1.1 KiB
C#

using System.Windows.Forms;
using System.Windows.Forms.Integration;
using Pulsar.Server.Controls.Wpf;
using Pulsar.Server.Statistics;
#nullable enable
namespace Pulsar.Server.Controls
{
public sealed class StatsElementHost : ElementHost
{
private readonly StatsView _statsView;
private ClientStatisticsSnapshot? _lastSnapshot;
public StatsElementHost()
{
_statsView = new StatsView();
Child = _statsView;
Dock = DockStyle.Fill;
}
public void ShowLoading()
{
_statsView.ShowLoading();
}
public void ShowError(string message)
{
_statsView.ShowError(message);
}
public void UpdateSnapshot(ClientStatisticsSnapshot snapshot)
{
_lastSnapshot = snapshot;
_statsView.UpdateSnapshot(snapshot);
}
public void ApplyTheme(bool isDarkMode)
{
_statsView.ApplyTheme(isDarkMode);
if (_lastSnapshot != null && !_lastSnapshot.HasError)
{
_statsView.UpdateSnapshot(_lastSnapshot);
}
}
}
}