예제 #1
0
        public void PublishFromResource(PublishFromResourceParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            var message = _resourcesService.GetResourceValueInSystemLanguage(parameters.ResourceUid);

            message = _resourcesService.FormatValue(message, parameters.Parameters);

            Publish(parameters.Type, message, parameters.TimeToLive);
        }
        public void publish_from_resource(string type, string resourceUid, string ttl = null)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }
            if (resourceUid == null)
            {
                throw new ArgumentNullException(nameof(resourceUid));
            }

            var parameters = new PublishFromResourceParameters
            {
                Type        = (NotificationType)Enum.Parse(typeof(NotificationType), type, true),
                ResourceUid = resourceUid
            };

            if (!string.IsNullOrEmpty(ttl))
            {
                parameters.TimeToLive = TimeSpan.Parse(ttl);
            }

            _notificationsService.PublishFromResource(parameters);
        }