Esempio n. 1
0
 public SmtpMessage Get(Guid id)
 {
     App.Current.WaiteForEndOfAllSessions();
     return(Directory.GetFiles(App.Current.MailFolderPath, "*.eml")
            .Select(path => SmtpMessage.CreateFrom(path))
            .First(a => a.Id == id));
 }
Esempio n. 2
0
 public IEnumerable <SmtpMessage> Get()
 {
     App.Current.WaiteForEndOfAllSessions();
     return(Directory.GetFiles(App.Current.MailFolderPath, "*.eml")
            .Select(path => SmtpMessage.CreateFrom(path))
            .OrderByDescending(m => m.Date));
 }
Esempio n. 3
0
        public void Delete(Guid id)
        {
            var pathToDelete = Directory.GetFiles(App.Current.MailFolderPath, "*.eml")
                               .Select(path => new { path, SmtpMessage.CreateFrom(path).Id })
                               .First(a => a.Id == id)
                               .path;

            File.Delete(pathToDelete);

            // notify via SignalR
            var hubContext = SignalR.GlobalHost.ConnectionManager.GetHubContext <SmtpServerHub>();

            SmtpServerHub.NotifyRemoveMessage(id, hubContext.Clients);
        }
Esempio n. 4
0
        public void Delete()
        {
            var hubContext = SignalR.GlobalHost.ConnectionManager.GetHubContext <SmtpServerHub>();

            Directory.GetFiles(App.Current.MailFolderPath, "*.eml")
            .Select(path => new { path, SmtpMessage.CreateFrom(path).Id })
            .ToList()
            .ForEach(m =>
            {
                File.Delete(m.path);

                // notify via SignalR
                SmtpServerHub.NotifyRemoveMessage(m.Id, hubContext.Clients);
            });
        }