private void Form1_FormClosed(object sender, FormClosedEventArgs e) { if (WebSocketsWrapper.IsConnected()) { WebSocketsWrapper.Disconnect(); } }
public static void UpdatePlayers() { while (WebSocketsWrapper.IsConnected()) { WebSocketsWrapper.SendCommand("playerlist"); Thread.Sleep(TimeSpan.FromSeconds(10)); } }
/// <summary> /// Formats the string for the status text /// </summary> /// <param name="text"></param> /// <returns></returns> private static string FormatStatus(string text) { var connected = WebSocketsWrapper.IsConnected() ? "Connected" : "Disconnected"; return($"{text} ({connected})"); }