Esempio n. 1
0
 public void Error(object sender, ErrorEventArgs e) { if (OnError != null)OnError(sender, e); }
Esempio n. 2
0
        private void OnError(object sender, ErrorEventArgs e)
        {
#if DEBUG
            Events.LogMessage(this, LogType.Error, "Error from {0}: {1}", sender.GetType().ToString(), e.type.ToString());
#endif

            if( e.policy != ErrorPolicyType.Informative )
                Events.Disconnect(this);
        }
Esempio n. 3
0
        private async void OnError(object sender, ErrorEventArgs e)
        {
            if (e.policy != ErrorPolicyType.Informative)
                PushEvent(StateType.Disconnected);

            if (e.policy == ErrorPolicyType.Reconnect)
            {
                if (IsInternetAvailable)
                {
                    if (_lastError == e.type && e.type != ErrorType.None)
                    {
                        e.policy = ErrorPolicyType.Deactivate;
                        _lastError = ErrorType.None;
                    }
                    else
                    {
                        // Remember the error
                        _lastError = e.type;

                        if (_updating)
                        {
                            _tryReconnect = true;
                        }
                        else
                        {
                            await Task.Delay(Runtime._eventDelayMS);
                            if (_currentParameters != null)
                            {
                                _currentParameters.UpdatedSettings = true;
                                Update(_currentParameters);
                            }
                        }

                        return;
                    }
                }
                else
                {          
                    return;
                }
            }
            
            PushEvent(e.type, e.policy, e.message);
        }