ReplayLoadingFailedControl.xaml.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using Content.Client.Stylesheets;
  2. using Robust.Client.AutoGenerated;
  3. using Robust.Client.UserInterface;
  4. using Robust.Client.UserInterface.Controls;
  5. using Robust.Client.UserInterface.XAML;
  6. using Robust.Shared.Utility;
  7. namespace Content.Client.Replay.UI.Loading;
  8. [GenerateTypedNameReferences]
  9. public sealed partial class ReplayLoadingFailedControl : Control
  10. {
  11. public ReplayLoadingFailedControl(IStylesheetManager stylesheet)
  12. {
  13. RobustXamlLoader.Load(this);
  14. Stylesheet = stylesheet.SheetSpace;
  15. LayoutContainer.SetAnchorPreset(this, LayoutContainer.LayoutPreset.Wide);
  16. }
  17. public void SetData(Exception exception, Action? cancelPressed, Action? retryPressed)
  18. {
  19. ReasonLabel.SetMessage(
  20. FormattedMessage.FromUnformatted(Loc.GetString("replay-loading-failed", ("reason", exception))));
  21. if (cancelPressed != null)
  22. {
  23. CancelButton.Visible = true;
  24. CancelButton.OnPressed += _ =>
  25. {
  26. cancelPressed();
  27. };
  28. }
  29. if (retryPressed != null)
  30. {
  31. RetryButton.Visible = true;
  32. RetryButton.OnPressed += _ =>
  33. {
  34. retryPressed();
  35. };
  36. }
  37. }
  38. }