Exemple #1
0
 /// <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();
 }
Exemple #2
0
 protected internal virtual void OnConnectionError(ConnectionErrorEventArgs e)
 {
     if (ConnectionError != null)
     {
         ConnectionError(this, e);
     }
 }
Exemple #3
0
        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);
        }
Exemple #5
0
 private static async Task OnClientError(object?sender, ConnectionErrorEventArgs args, CancellationToken cancellationToken)
 {
     if (_client != null)
     {
         await _client.CloseAsync();
     }
     Console.WriteLine($"Error: {args.Message}");
 }
Exemple #6
0
 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");
 }
Exemple #7
0
 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);
         }
     }
 }
Exemple #8
0
 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));
     }
 }
Exemple #9
0
        /// <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);
            }
        }
Exemple #10
0
 void Server_OnError(object sender, ConnectionErrorEventArgs e)
 {
     AppendLog("Error[" + e.ConnectionName + "]: " + e.Message);
 }
 void et_ConnectionError(object sender, ConnectionErrorEventArgs e)
 {
     et.Dispose();
     et = null;
 }
Exemple #12
0
 /// <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();
 }
Exemple #13
0
 private void HandleConnectionError(object sender, ConnectionErrorEventArgs e)
 {
     // Abort calibration if the connection fails
     AbortCalibration();
 }
Exemple #14
0
 // 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);
 }
Exemple #15
0
 private void HandleConnectionError(object sender, ConnectionErrorEventArgs e)
 {
     AbortConfirm();
 }
Exemple #16
0
 void et_ConnectionError(object sender, ConnectionErrorEventArgs e)
 {
     et.Dispose();
     et = null;
 }
Exemple #17
0
        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);
        }
Exemple #18
0
 private void HandleConnectionError(object sender, ConnectionErrorEventArgs e)
 {
     // Abort calibration if the connection fails
     AbortCalibration();
 }
Exemple #19
0
 /// <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();
 }
Exemple #20
0
 private void HandleConnectionError(object sender, ConnectionErrorEventArgs e)
 {
     DisconnectTracker();
 }
Exemple #21
0
 private void msnMessenger_ConnectionFailure(Messenger sender, ConnectionErrorEventArgs e)
 {
     MessageBox.Show(e.Error.ErrorCode.ToString(),"Connection Error");
 }
Exemple #22
0
 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();
 }
Exemple #24
0
 /// <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();
 }