Esempio n. 1
0
        public Task SendAsync(DispatchArgs args, CancellationToken cancellation = default)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }
            cancellation.ThrowIfCancellationRequested();
            args.From     = this.Instance;
            args.AppletId = this.AppletId;

            if (CanSend(args.IntentId))
            {
                return(this.BroadcastAsync(args, cancellation));
            }

            var intentName = _appInfo.GetIntentName(args.IntentId);

            throw new InvalidOperationException(
                      new StringBuilder($"The specified outgoing message intent is forbidden for this applet.")
                      .Append($" Sender applet: {AppletName} ({AppletId}).")
                      .Append($" Message intent: {intentName} ({args.IntentId}).")
                      .Append($" See {_appInfo.GetType()} type constructor.")
                      .ToString()
                      );
        }