/// <summary> /// This method handles a connection error by disconnecting. /// </summary> /// <param name="sender"> /// Source of the event /// </param> /// <param name="e"> /// The <see cref="ConnectionErrorEventArgs"/> with the new gaze data /// from the device. /// </param> private void HandleConnectionError(object sender, ConnectionErrorEventArgs e) { // If the connection goes down we dispose // the IAsyncEyetracker instance. This will release // all resources held by the connection this.DisconnectTracker(); }
protected internal virtual void OnConnectionError(ConnectionErrorEventArgs e) { if (ConnectionError != null) { ConnectionError(this, e); } }
private async Task OnReceiveCore() { if (_msgReceiveTokenSource == null) { return; } try { var token = _msgReceiveTokenSource.Token; var socket = _socket; while (socket.State == WebSocketState.Open && !token.IsCancellationRequested) { // 收取一个完整的包 var msg = await ReadPacket(socket, token); if (msg is null) { continue; } await _messagesChannel.Writer.WriteAsync(msg, token); } } catch (Exception e) { var args = new ConnectionErrorEventArgs(e.Message, e); Debug.WriteLine($"Tag:{Tag}, Exp:{e.Message}"); if (ErrorAsyncAction != null) { await ErrorAsyncAction(args); } } }
private void OnErrorReceivedFromServerAsync( object sender, ConnectionErrorEventArgs args) { Debug.Assert(!this.InvokeRequired); ShowErrorAndClose("SSH connection terminated", args.Error); }
private static async Task OnClientError(object?sender, ConnectionErrorEventArgs args, CancellationToken cancellationToken) { if (_client != null) { await _client.CloseAsync(); } Console.WriteLine($"Error: {args.Message}"); }
private void _client_ConnectionError(object sender, ConnectionErrorEventArgs e) { if (_dialhotkey != null) { _hotkeymanager.Unregister(_dialhotkey); } this.SetFormState(false); this.SetTrayStatus("Connection error: " + e.Exception.Message, "error"); }
protected virtual void WorkspaceConnectionError(object sender, ConnectionErrorEventArgs args) { if (App.IsShowedFriendlyScreen == false) { //check methods if (args.Method.ToLower().Contains("add_event") || args.Method.ToLower().Contains("callsigns")) { } else { ShowErrorMessage(AppResources.ConnectionError); } } }
async void HandleConnectError(object sender, ConnectionErrorEventArgs e) { GetServerSection(e.Server); if (e.Exception is NotAuthenticatedException) { if (e.Server.Authenticate(this)) { JabbRApplication.Instance.SaveConfiguration(); await e.Server.Connect(); } } else { MessageBox.Show(this, e.Exception.GetBaseException().Message, string.Format("Could not connect to server {0}", e.Server.Name)); } }
/// <summary> /// On connection error /// </summary> ///<param name="e">ConnectionErrorEventArgs parameter</param> protected virtual void OnConnectionError(ConnectionErrorEventArgs e) { EventHandler <ConnectionErrorEventArgs> handler = ConnectionError; if (handler != null) { if (e != null && e.IsInError) { IsConnectionInError = true; } else { IsConnectionInError = false; } handler(this, e); } }
void Server_OnError(object sender, ConnectionErrorEventArgs e) { AppendLog("Error[" + e.ConnectionName + "]: " + e.Message); }
void et_ConnectionError(object sender, ConnectionErrorEventArgs e) { et.Dispose(); et = null; }
/// <summary> /// Disconnects from eyetracker on error. /// </summary> /// <param name="sender"></param> /// <param name="e">Contains error code</param> private void ConnectionError(object sender, ConnectionErrorEventArgs e) { Console.WriteLine("Error: " + EyetrackerErrors.getDescription(e.ErrorCode)); Console.WriteLine("Disconnecting from " + info.ProductId); Disconnect(); }
private void HandleConnectionError(object sender, ConnectionErrorEventArgs e) { // Abort calibration if the connection fails AbortCalibration(); }
// handle connection errors private void HandleConnectionError(object sender, ConnectionErrorEventArgs e) { // If the connection goes down we dispose the IAsyncEyetracker instance. This will release all resources held by the connection OnConnectionError(sender, e); DisconnectEyetracker(false); }
private void HandleConnectionError(object sender, ConnectionErrorEventArgs e) { AbortConfirm(); }
private bool TryConnect() { if (_connectionTimer.Enabled) { return(true); } var connected = false; while (!connected) { if (!SpotifyLocalAPI.IsSpotifyRunning()) { if (!_processStarted) { // Try to start the Spotify client and try to connect again _processStarted = true; try { Process.Start(Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Spotify", "Spotify.exe")); continue; } catch (Win32Exception) { // Could not find or start Spotify client } } var eventArgs = new ConnectionErrorEventArgs(ConnectionErrorEventArgs.Type.SpotifyNotRunning); OnConnectionError?.Invoke(this, eventArgs); if (eventArgs.Retry) { continue; } else { break; } } if (!SpotifyLocalAPI.IsSpotifyWebHelperRunning()) { var eventArgs = new ConnectionErrorEventArgs(ConnectionErrorEventArgs.Type.SpotifyWebHelperConnection); OnConnectionError?.Invoke(this, eventArgs); if (eventArgs.Retry) { continue; } else { break; } } if (!_spotify.Connect()) { var eventArgs = new ConnectionErrorEventArgs(ConnectionErrorEventArgs.Type.SpotifyConnection); OnConnectionError?.Invoke(this, eventArgs); if (eventArgs.Retry) { continue; } else { break; } } connected = true; } // Restart the timer _connectionTimer.Start(); return(connected); }
private void HandleConnectionError(object sender, ConnectionErrorEventArgs e) { DisconnectTracker(); }
private void msnMessenger_ConnectionFailure(Messenger sender, ConnectionErrorEventArgs e) { MessageBox.Show(e.Error.ErrorCode.ToString(),"Connection Error"); }
void FEyetracker_ConnectionError(object sender, ConnectionErrorEventArgs e) { FLogger.Log(LogType.Error, "Eyetracker Connection Error:" + e.ErrorCode); FConnectionChanged = true; }
private void HandleConnectionError(object sender, ConnectionErrorEventArgs e) { AbortCalibration(); }