Ejemplo n.º 1
0
        public virtual void NotifyActionEvent(QQActionEventType type, object target)
        {
            switch (type)
            {
            case QQActionEventType.EvtError:
            {
                var ex = (QQException)target;
                //Context.Logger.LogError($"[Action={GetType().Name}, Type={type}, {ex}");
                Context.FireNotify(new QQNotifyEvent(QQNotifyEventType.NetError, ex));
                break;
            }

            case QQActionEventType.EvtRetry:
            {
                var ex = (QQException)target;
                // Context.Logger.LogWarning($"[Action={GetType().Name}, Type={type}, RetryTimes={_retryTimes}][{ex.ToSimpleString()}]");
                break;
            }

            case QQActionEventType.EvtCanceled:
            {
                //Context.Logger.LogInformation($"[Action={GetType().Name}, Type={type}, Target={target}]");
                break;
            }

            default:
            {
                //Context.Logger.LogDebug($"[Action={GetType().Name}, Type={type}");
                break;
            }
            }
            Listener?.Invoke(this, new QQActionEvent(type, target));
        }
Ejemplo n.º 2
0
        private bool IsFinalEvent(QQActionEvent Event)
        {
            QQActionEventType type = Event.Type;

            return(type == QQActionEventType.EVT_CANCELED ||
                   type == QQActionEventType.EVT_ERROR ||
                   type == QQActionEventType.EVT_OK);
        }
Ejemplo n.º 3
0
        public virtual void NotifyActionEvent(QQActionEventType type, object target)
        {
            switch (type)
            {
            case QQActionEventType.EVT_ERROR:
                var ex = (target as Exception) ?? new QQException(QQErrorCode.UNKNOWN_ERROR);
#if DEBUG
                MyLogger.Default.Error($"{GetType().Name} [type={type.GetDescription()}, exception={ex.Message}, stacktrace={ex.StackTrace}]", ex);
#else
                MyLogger.Default.Debug($"{GetType().Name} [type={type.GetDescription()}, exception={ex.Message}", ex);
#endif
                break;

            case QQActionEventType.EVT_CANCELED:
                MyLogger.Default.Info($"{GetType().Name} [type={type.GetDescription()}, target={target}]");
                break;

            default:
                MyLogger.Default.Debug($"{GetType().Name} [type={type.GetDescription()}, target={target}]");
                break;
            }
            Listener?.Invoke(ActionFuture, new QQActionEvent(type, target));
        }
Ejemplo n.º 4
0
 public void NotifyActionEvent(QQActionEventType type, object target)
 {
     Listener?.Invoke(this, new QQActionEvent(type, target));
 }
Ejemplo n.º 5
0
 public QQActionEvent(QQActionEventType type, object target)
 {
     Type   = type;
     Target = target;
 }
Ejemplo n.º 6
0
        public virtual void NotifyActionEvent(QQActionEventType type, object target)
        {
            switch (type)
            {
                case QQActionEventType.EVT_ERROR:
                var ex = (target as Exception) ?? new QQException(QQErrorCode.UNKNOWN_ERROR);
                MyLogger.Default.Error($"{GetType().Name} [type={type.GetDescription()}, exception={ex.Message}, stacktrace={ex.StackTrace}]",ex);
                break;

                case QQActionEventType.EVT_CANCELED:
                MyLogger.Default.Info($"{GetType().Name} [type={type.GetDescription()}, target={target}]");
                break;

                default:
                MyLogger.Default.Debug($"{GetType().Name} [type={type.GetDescription()}, target={target}]");
                break;
            }
            Listener?.Invoke(ActionFuture, new QQActionEvent(type, target));
        }
Ejemplo n.º 7
0
 public QQActionEvent(QQActionEventType type, object target)
 {
     Type = type;
     Target = target;
 }
Ejemplo n.º 8
0
 public virtual void NotifyActionEvent(QQActionEventType type, object target)
 {
     switch (type)
     {
         case QQActionEventType.EvtError:
         {
             var ex = (QQException)target;
             Context.Logger.LogError($"[Action={GetType().Name}, Type={type}, {ex}");
             Context.FireNotify(new QQNotifyEvent(QQNotifyEventType.NetError, ex));
             break;
         }
         case QQActionEventType.EvtRetry:
         {
             var ex = (QQException)target;
             Context.Logger.LogWarning($"[Action={GetType().Name}, Type={type}, RetryTimes={_retryTimes}][{ex.ToSimpleString()}]");
             break;
         }
         case QQActionEventType.EvtCanceled:
         {
             Context.Logger.LogInformation($"[Action={GetType().Name}, Type={type}, Target={target}]");
             break;
         }
         default:
         {
             Context.Logger.LogDebug($"[Action={GetType().Name}, Type={type}");
             break;
         }
     }
     Listener?.Invoke(this, new QQActionEvent(type, target));
 }
 public void NotifyActionEvent(QQActionEventType type, object target)
 {
     Listener?.Invoke(this, new QQActionEvent(type, target));
 }