Exemplo n.º 1
0
        public void ReadMessages(Folder f)
        {
            if (f.ContentCount > 0)
            {
                using (var fs = ndb.GetReadStream())
                {
                    // Get the Contents table for the folder
                    // For 4K, not all the properties we want are available in the Contents table, so supplement them from the Message itself
                    var ms = ltp.ReadTable <Message>(fs, NID.TypedNID(EnidType.CONTENTS_TABLE, f.Nid),
                                                     ndb.IsUnicode4K ? pgMessageList4K : pgMessageList, (m, id) => m.Nid = new NID(id))
                             .Select(m => ndb.IsUnicode4K ? Add4KMessageProperties(fs, m) : m)
                             .ToList();    // to force complete execution on the current thread

                    // We may be called on a background thread, so we need to dispatch this to the UI thread
                    Application.Current.Dispatcher.Invoke(new Action(() =>
                    {
                        f.Messages.Clear();
                        foreach (var m in ms)
                        {
                            f.AddMessage(m);
                        }
                    }));
                }
            }
        }
Exemplo n.º 2
0
        public void ReadMessages(Folder f)
        {
            if (f.ContentCount > 0)
            {
                using (var fs = ndb.GetReadStream())
                {
                    // Get the Contents table for the folder
                    var ms = ltp.ReadTable <Message>(fs, NID.TypedNID(EnidType.CONTENTS_TABLE, f.Nid),
                                                     ndb.IsUnicode4K ? pgMessageList4K : pgMessageList, (m, id) => m.Nid = new NID(id));

                    if (ndb.IsUnicode4K)
                    {
                        foreach (var m in ms)
                        {
                            ltp.ReadProperties <Message>(fs, m.Nid, pgMessageDetail4K, m);
                        }
                    }

                    // We may be called on a background thread, so we need to dispatch this to the UI thread
                    Application.Current.Dispatcher.Invoke(new Action(() =>
                    {
                        f.Messages.Clear();
                        foreach (var m in ms)
                        {
                            f.AddMessage(m);
                        }
                    }));
                }
            }
        }
Exemplo n.º 3
0
 public List <Message> ReadMessages(Folder f)
 {
     f.Messages.Clear();
     if (f.ContentCount > 0)
     {
         using (var fs = ndb.GetReadStream())
         {
             // Get the Contents table for the folder
             // For 4K, not all the properties we want are available in the Contents table, so supplement them from the Message itself
             var ms = ltp.ReadTable <Message>(fs, NID.TypedNID(EnidType.CONTENTS_TABLE, f.Nid),
                                              ndb.IsUnicode4K ? pgMessageList4K : pgMessageList, (m, id) => m.Nid = new NID(id))
                      .Select(m => ndb.IsUnicode4K ? Add4KMessageProperties(fs, m) : m)
                      .Select(m => f.AddMessage(m))
                      .ToList();    // to force complete execution on the current thread
             return(ms);
         }
     }
     return(new List <Message>());
 }