private void Connection_ConnectionLost(object sender, DisconnectEventArgs e) { if (e.Reason == DisconnectReason.UserInitiated) { Disconnected.Fire(this, e); } else { ConnectionLost.Fire(this, e); } }
private void server_ConnectionLost(object sender, DisconnectEventArgs e) { AddLine(ServerStrings.ConnectionLost.With(SocketErrorTranslator.GetMessage(e.SocketErrorCode))); if (e.Reason != DisconnectReason.UserInitiated) { AddLine(ServerStrings.AttemptingReconnect); ThreadHelper.InvokeAfter(TimeSpan.FromSeconds(4), delegate { server.Connect(); }); } }