using Content.Shared.CartridgeLoader.Cartridges; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.XAML; namespace Content.Client.CartridgeLoader.Cartridges; [GenerateTypedNameReferences] public sealed partial class LogProbeUiFragment : BoxContainer { public LogProbeUiFragment() { RobustXamlLoader.Load(this); } public void UpdateState(List logs) { ProbedDeviceContainer.RemoveAllChildren(); //Reverse the list so the oldest entries appear at the bottom logs.Reverse(); var count = 1; foreach (var log in logs) { AddAccessLog(log, count); count++; } } private void AddAccessLog(PulledAccessLog log, int numberLabelText) { var timeLabelText = TimeSpan.FromSeconds(Math.Truncate(log.Time.TotalSeconds)).ToString(); var accessorLabelText = log.Accessor; var entry = new LogProbeUiEntry(numberLabelText, timeLabelText, accessorLabelText); ProbedDeviceContainer.AddChild(entry); } }