GeneralRecord.xaml.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. using Content.Shared.StationRecords;
  2. using Robust.Client.AutoGenerated;
  3. using Robust.Client.UserInterface;
  4. using Robust.Client.UserInterface.XAML;
  5. using Robust.Shared.Enums;
  6. namespace Content.Client.StationRecords;
  7. [GenerateTypedNameReferences]
  8. public sealed partial class GeneralRecord : Control
  9. {
  10. public Action<uint>? OnDeletePressed;
  11. public GeneralRecord(GeneralStationRecord record, bool canDelete, uint? id)
  12. {
  13. RobustXamlLoader.Load(this);
  14. RecordName.Text = record.Name;
  15. Age.Text = Loc.GetString("general-station-record-console-record-age", ("age", record.Age.ToString()));
  16. Title.Text = Loc.GetString("general-station-record-console-record-title",
  17. ("job", Loc.GetString(record.JobTitle)));
  18. Species.Text = Loc.GetString("general-station-record-console-record-species", ("species", record.Species));
  19. Gender.Text = Loc.GetString("general-station-record-console-record-gender",
  20. ("gender", record.Gender.ToString()));
  21. Fingerprint.Text = Loc.GetString("general-station-record-console-record-fingerprint",
  22. ("fingerprint", record.Fingerprint ?? Loc.GetString("generic-not-available-shorthand")));
  23. Dna.Text = Loc.GetString("general-station-record-console-record-dna",
  24. ("dna", record.DNA ?? Loc.GetString("generic-not-available-shorthand")));
  25. if (canDelete && id != null )
  26. {
  27. DeleteButton.Visible = true;
  28. DeleteButton.OnPressed += _ => OnDeletePressed?.Invoke(id.Value);
  29. }
  30. }
  31. }