コード例 #1
0
ファイル: EventDispatchProxy.cs プロジェクト: zouql/EventNext
 public Task Execute()
 {
     if (Output.EventError != EventError.Success)
     {
         if (EventCenter.EnabledLog(LogType.Debug))
         {
             EventCenter.Log(LogType.Debug, $"{Input.Token} {EventDispatchProxy.Type.Name} proxy execute {Input.EventPath} error {(string)Output.Data[0]}");
         }
         ENException exception = new ENException((string)Output.Data[0]);
         exception.EventError = Output.EventError;
         CompletionSource.Error(exception);
     }
     else
     {
         if (EventCenter.EnabledLog(LogType.Debug))
         {
             EventCenter.Log(LogType.Debug, $"{Input.Token} {EventDispatchProxy.Type.Name} proxy execute {Input.EventPath} successed!");
         }
         if (Output.Data != null && Output.Data.Length > 0)
         {
             CompletionSource.Success(Output.Data[0]);
         }
         else
         {
             CompletionSource.Success(new object());
         }
     }
     return(Task.CompletedTask);
 }
コード例 #2
0
ファイル: ViewController.cs プロジェクト: keiji/chino
        private void ShowENException(ENException enException)
        {
            Logger.D($"ENException - Code:{enException.Code}, {enException.Message}");

            string message = enException.Code switch
            {
                ENException.Code_iOS.ApiMisuse => "ApiMisuse",
                ENException.Code_iOS.BadFormat => "BadFormat",
                ENException.Code_iOS.BadParameter => "BadParameter",
                ENException.Code_iOS.BluetoothOff => "BluetoothOff",
                ENException.Code_iOS.DataInaccessible => "DataInaccessible",
                ENException.Code_iOS.InsufficientMemory => "InsufficientMemory",
                ENException.Code_iOS.InsufficientStorage => "InsufficientStorage",
                ENException.Code_iOS.Internal => "Internal",
                ENException.Code_iOS.Invalidated => "Invalidated",
                ENException.Code_iOS.NotAuthorized => "NotAuthorized",
                ENException.Code_iOS.NotEnabled => "NotEnabled",
                ENException.Code_iOS.NotEntitled => "NotEntitled",
                ENException.Code_iOS.RateLimited => "RateLimited",
                ENException.Code_iOS.Restricted => "Restricted",
                ENException.Code_iOS.TravelStatusNotAvailable => "TravelStatusNotAvailable",
                ENException.Code_iOS.Unsupported => "Unsupported",
                _ => "Unknown",
            };

            status.Text = $"ENException: {message}";
        }
コード例 #3
0
 protected override object Invoke(MethodInfo targetMethod, object[] args)
 {
     if (!mHandlers.TryGetValue(targetMethod.Name, out ActionHandlerProxy handler))
     {
         var error = new ENException($"{targetMethod.Name} action not found!");
         error.EventError = EventError.NotFound;
         throw error;
     }
     else
     {
         if (!handler.IsTaskResult)
         {
             var error = new ENException("Definition is not supported, please define task with return value!");
             error.EventError = EventError.NotSupport;
             throw error;
         }
         var input = new EventInput();
         input.ID        = EventCenter.GetInputID();
         input.EventPath = handler.Url;
         input.Data      = args;
         if (Actor != EventCenter.ACTOR_NULL_TAG)
         {
             input.Properties = new Dictionary <string, string>();
             input.Properties[EventCenter.ACTOR_TAG] = this.Actor;
         }
         if (mHeader.Count > 0)
         {
             if (input.Properties == null)
             {
                 input.Properties = new Dictionary <string, string>();
             }
             foreach (var item in mHeader)
             {
                 input.Properties[item.Key] = item.Value;
             }
         }
         var            task      = handler.GetCompletionSource();
         ProxyInputWork inputWork = new ProxyInputWork {
             CompletionSource = task, Input = input, EventCenter = EventCenter, DispatchProxy = this
         };
         if (Actor == EventCenter.ACTOR_NULL_TAG)
         {
             if (EventCenter.EnabledLog(LogType.Debug))
             {
                 EventCenter.Log(LogType.Debug, $"{input.Token} {Type.Name} proxy executing {input.EventPath}");
             }
         }
         else
         {
             if (EventCenter.EnabledLog(LogType.Debug))
             {
                 EventCenter.Log(LogType.Debug, $"{input.Token} {Type.Name} proxy {Type.Name}/{Actor} actor executing {input.EventPath} ");
             }
         }
         inputWork.Execute();
         return(task.GetTask());
     }
 }
コード例 #4
0
        protected void LogException(ENException ex)
        {
            errors.Add(ex);

            log.Error(ex);

            if (errors.Count > Constants.MAXERRS)
            {
                throw new ENException(ErrorCode.Err200);
            }
        }
コード例 #5
0
 public Task ExceptionOccurredAsync(ENException exception)
 {
     _loggerService.Value.Exception($"ENExcepiton occurred, Code:{exception.Code}, Message:{exception.Message}", exception);
     return(Task.CompletedTask);
 }
コード例 #6
0
 private bool CheckMaxPerDayExposureDetectionAPILimitReached(ENException ex)
 {
     return(ex.Code == ENException.Code_iOS.RateLimited || ex.Code == ENException.Code_Android.FAILED_RATE_LIMITED);
 }
コード例 #7
0
ファイル: MainViewModel.cs プロジェクト: keiji/chino.prism
 private void ProcessEnException(ENException enException)
 {
     _status = $"ENException Code:{enException.Code} is occurred - {enException.Message}";
     PropertyChanged(this, new PropertyChangedEventArgs("Statuses"));
 }