Esempio n. 1
0
        public static IObservable <MimeMessage> GetObservable([NotNull] this MimeMessageLoader loader, [NotNull] MessageEntry entry, CancellationToken token = default)
        {
            if (loader == null)
            {
                throw new ArgumentNullException(nameof(loader));
            }
            if (entry == null)
            {
                throw new ArgumentNullException(nameof(entry));
            }

            return(loader.GetAsync(entry, token).ToObservable(TaskPoolScheduler.Default));
        }
Esempio n. 2
0
        public static async Task <MimeMessage> GetClonedAsync([NotNull] this MimeMessageLoader loader, [NotNull] MessageEntry entry, CancellationToken token = default)
        {
            if (loader == null)
            {
                throw new ArgumentNullException(nameof(loader));
            }
            if (entry == null)
            {
                throw new ArgumentNullException(nameof(entry));
            }

            var message = await loader.GetAsync(entry, token);

            return(await message.CloneMessageAsync(token));
        }
Esempio n. 3
0
        public static MimeMessage Get([NotNull] this MimeMessageLoader loader, [NotNull] MessageEntry entry)
        {
            if (loader == null)
            {
                throw new ArgumentNullException(nameof(loader));
            }
            if (entry == null)
            {
                throw new ArgumentNullException(nameof(entry));
            }

            var loadTask = loader.GetAsync(entry);

            loadTask.Wait();

            return(loadTask.Result);
        }