Пример #1
0
 public static FolderViewState FindViewState(string[] folderViewStates, string folderId)
 {
     if (folderViewStates != null)
     {
         DataContractJsonSerializer dataContractJsonSerializer = new DataContractJsonSerializer(typeof(FolderViewState));
         foreach (string s in folderViewStates)
         {
             try
             {
                 using (MemoryStream memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(s)))
                 {
                     FolderViewState folderViewState = dataContractJsonSerializer.ReadObject(memoryStream) as FolderViewState;
                     if (folderViewState != null && folderViewState.FolderId != null && folderViewState.FolderId.Id == folderId)
                     {
                         return(folderViewState);
                     }
                 }
             }
             catch (IOException)
             {
             }
             catch (InvalidDataContractException)
             {
             }
             catch (SerializationException)
             {
             }
         }
     }
     return(FolderViewState.Default);
 }
Пример #2
0
        public static SortBy[] GetSortByForFolderViewState(FolderViewState folderViewState)
        {
            MailSortOptions mailSortOptions;

            if (MailSortOptions.columnMap.TryGetValue(folderViewState.SortColumn, out mailSortOptions))
            {
                return(mailSortOptions.AsSortBy(folderViewState.View, folderViewState.SortOrder));
            }
            return(null);
        }