Make admin logs (reliably) refresh when opening

This commit is contained in:
DrSmugleaf
2021-12-25 19:18:04 +01:00
parent 928c070bda
commit 1e42bafea4

View File

@@ -98,25 +98,10 @@ public class AdminLogsEui : BaseEui
LogsControl.PopOutButton.Visible = false; LogsControl.PopOutButton.Visible = false;
} }
private bool TrySetFirstState(AdminLogsEuiState state)
{
if (!FirstState)
{
return false;
}
FirstState = false;
LogsControl.SetCurrentRound(state.RoundId);
LogsControl.SetRoundSpinBox(state.RoundId);
return true;
}
public override void HandleState(EuiStateBase state) public override void HandleState(EuiStateBase state)
{ {
var s = (AdminLogsEuiState) state; var s = (AdminLogsEuiState) state;
var first = TrySetFirstState(s);
if (s.IsLoading) if (s.IsLoading)
{ {
return; return;
@@ -125,10 +110,14 @@ public class AdminLogsEui : BaseEui
LogsControl.SetCurrentRound(s.RoundId); LogsControl.SetCurrentRound(s.RoundId);
LogsControl.SetPlayers(s.Players); LogsControl.SetPlayers(s.Players);
if (first) if (!FirstState)
{ {
RequestLogs(); return;
} }
FirstState = false;
LogsControl.SetRoundSpinBox(s.RoundId);
RequestLogs();
} }
public override void HandleMessage(EuiMessageBase msg) public override void HandleMessage(EuiMessageBase msg)