/// <summary> /// Attempt to reconnect to the server. Called when connection has closed. /// </summary> public void Reconnect() { if (_reconnecting) { return; } try { _reconnecting = true; Connect(); } catch (Exception ex) { Common.LogError(ex); Notifications.ChangeTrayText(MessageType.Disconnected); ReconnectingFailed.SafeInvoke(null, EventArgs.Empty); } finally { _reconnecting = false; } }
/// <summary> /// Attempt to reconnect to the server. Called when connection has closed. /// </summary> public async Task Reconnect() { if (_reconnecting) { return; } try { _reconnecting = true; await Connect(); } catch (Exception ex) { ex.LogException(); Notifications.ChangeTrayText(MessageType.Disconnected); ReconnectingFailed.SafeInvoke(null, EventArgs.Empty); } finally { _reconnecting = false; } }