fix: make reconnect look better
This commit is contained in:
parent
4221e53f2e
commit
51a088d8a3
|
@ -86,6 +86,7 @@ internal class Client : IDisposable {
|
|||
internal void StopLoop() {
|
||||
this._active = false;
|
||||
this.WebSocket.Abort();
|
||||
this.Status = State.Disconnected;
|
||||
}
|
||||
|
||||
internal void StartLoop() {
|
||||
|
|
|
@ -104,11 +104,14 @@ internal class PluginUi : IDisposable {
|
|||
var status = this.Plugin.Client.Status;
|
||||
ImGui.TextUnformatted($"Status: {status}");
|
||||
ImGui.SameLine();
|
||||
if (ImGuiUtil.IconButton(FontAwesomeIcon.Wifi, tooltip: "Reconnect")) {
|
||||
if (ImGuiUtil.IconButton(FontAwesomeIcon.Wifi, tooltip: "Reconnect") && !this._busy) {
|
||||
this._busy = true;
|
||||
|
||||
Task.Run(async () => {
|
||||
this.Plugin.Client.StopLoop();
|
||||
await Task.Delay(TimeSpan.FromSeconds(5));
|
||||
this.Plugin.Client.StartLoop();
|
||||
this._busy = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue