// Token: 0x06002D78 RID: 11640 RVA: 0x000FFCB0 File Offset: 0x000FDEB0
 private void BindToFolder()
 {
     if (this.folder == null)
     {
         OwaStoreObjectId owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("fId");
         if (owaStoreObjectId == null)
         {
             owaStoreObjectId = (OwaStoreObjectId)this.ListViewState.SourceContainerId;
         }
         this.folder = Utilities.GetFolder <Folder>(base.UserContext, owaStoreObjectId, new PropertyDefinition[]
         {
             FolderSchema.ItemCount,
             FolderSchema.ExtendedFolderFlags,
             ViewStateProperties.ViewFilter,
             ViewStateProperties.SortColumn
         });
         if (base.IsParameterSet("srchf") && (base.UserContext.IsInMyMailbox(this.folder) || Utilities.IsInArchiveMailbox(this.folder)))
         {
             FolderVirtualListViewSearchFilter folderVirtualListViewSearchFilter = (FolderVirtualListViewSearchFilter)base.GetParameter("srchf");
             if (folderVirtualListViewSearchFilter.SearchString != null && 256 < folderVirtualListViewSearchFilter.SearchString.Length)
             {
                 throw new OwaInvalidRequestException("Search string is longer than maximum length of " + 256);
             }
             FolderSearch folderSearch = new FolderSearch();
             string       searchString = folderVirtualListViewSearchFilter.SearchString;
             this.searchFolder = folderSearch.Execute(base.UserContext, this.folder, folderVirtualListViewSearchFilter.Scope, searchString, folderVirtualListViewSearchFilter.ReExecuteSearch, folderVirtualListViewSearchFilter.IsAsyncSearchEnabled);
         }
     }
 }
Beispiel #2
0
 public void CreateListView()
 {
     if (this.searchLocation == AddressBook.SearchLocation.AddressBook)
     {
         this.listView = new AddressBookListView(this.searchString, base.UserContext, ColumnId.DisplayNameAD, SortOrder.Ascending, this.addressBookBase, AddressBookBase.RecipientCategory.All);
     }
     else
     {
         FolderSearch folderSearch = new FolderSearch();
         SearchScope  searchScope  = base.UserContext.MailboxSession.Mailbox.IsContentIndexingEnabled ? SearchScope.SelectedAndSubfolders : SearchScope.SelectedFolder;
         this.searchFolder = folderSearch.Execute(base.UserContext, this.folder, searchScope, this.searchString, this.isNewSearch, false);
         object obj = this.searchFolder.TryGetProperty(FolderSchema.ItemCount);
         if (!(obj is PropertyError))
         {
             this.itemCount = (int)obj;
         }
         this.listView = new ContactsListView(base.UserContext, this.sortColumn, this.sortOrder, this.searchFolder, searchScope);
     }
     this.listView.Initialize(this.firstItemOnPage, this.lastItemOnPage);
     if (!string.IsNullOrEmpty(this.searchString))
     {
         SanitizedHtmlString sanitizedHtmlString = new SanitizedHtmlString("<a href=\"#\" onclick=\"return onClkClrLnk();\">" + LocalizedStrings.GetHtmlEncoded(1155007962) + "</a>");
         sanitizedHtmlString.DecreeToBeTrusted();
         SanitizedHtmlString messageHtml;
         if (this.listView.TotalCount == 0)
         {
             messageHtml = SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(-761327948), new object[]
             {
                 sanitizedHtmlString
             });
         }
         else if (this.searchLocation == AddressBook.SearchLocation.AddressBook)
         {
             if (this.addressBookBase.Base64Guid == base.UserContext.GlobalAddressListInfo.ToAddressBookBase().Base64Guid)
             {
                 messageHtml = SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(-121508646), new object[]
                 {
                     this.listView.TotalCount,
                     this.searchString,
                     sanitizedHtmlString
                 });
             }
             else
             {
                 messageHtml = SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(-1725472335), new object[]
                 {
                     this.listView.TotalCount,
                     this.searchString,
                     this.addressBookBase.DisplayName,
                     sanitizedHtmlString
                 });
             }
         }
         else
         {
             messageHtml = SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(-1403744948), new object[]
             {
                 this.listView.TotalCount,
                 this.searchString,
                 sanitizedHtmlString
             });
         }
         base.Infobar.AddMessageHtml(messageHtml, InfobarMessageType.Informational);
     }
 }
        public static ItemOperations.Result GetNextViewItem(UserContext userContext, ItemOperations.Action action, StoreObjectId itemId, StoreObjectId folderId)
        {
            Folder folder = null;

            ItemOperations.Result result;
            try
            {
                MessageModuleSearchViewState messageModuleSearchViewState = userContext.LastClientViewState as MessageModuleSearchViewState;
                SortBy[] sortOrder;
                if (messageModuleSearchViewState != null)
                {
                    using (Folder folder2 = Folder.Bind(userContext.MailboxSession, messageModuleSearchViewState.FolderId))
                    {
                        sortOrder = ItemOperations.GetSortOrder(userContext, folder2);
                        FolderSearch folderSearch = new FolderSearch();
                        folder = folderSearch.Execute(userContext, folder2, messageModuleSearchViewState.SearchScope, messageModuleSearchViewState.SearchString, userContext.ForceNewSearch, false);
                        userContext.ForceNewSearch = false;
                        goto IL_77;
                    }
                }
                folder    = Folder.Bind(userContext.MailboxSession, folderId);
                sortOrder = ItemOperations.GetSortOrder(userContext, folder);
IL_77:
                using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.None, null, sortOrder, new PropertyDefinition[]
                {
                    ItemSchema.Id
                }))
                {
                    queryResult.SeekToCondition(SeekReference.OriginBeginning, new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.Id, itemId));
                    int num  = queryResult.CurrentRow;
                    int num2 = queryResult.EstimatedRowCount;
                    int num3 = 0;
                    if (num == num2 || num2 == 1)
                    {
                        result = null;
                    }
                    else
                    {
                        switch (action)
                        {
                        case ItemOperations.Action.Next:
                            if (num + 1 == num2)
                            {
                                return(null);
                            }
                            num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, 1);
                            break;

                        case ItemOperations.Action.Prev:
                            if (num == 0)
                            {
                                return(null);
                            }
                            num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, -1);
                            break;

                        case ItemOperations.Action.Delete:
                            if (userContext.UserOptions.NextSelection == NextSelectionDirection.Previous)
                            {
                                if (num == 0)
                                {
                                    num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, 1);
                                    num3 = 0;
                                }
                                else
                                {
                                    num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, -1);
                                }
                            }
                            else if (userContext.UserOptions.NextSelection == NextSelectionDirection.Next)
                            {
                                if (num2 - (num + 1) == 0)
                                {
                                    num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, -1);
                                }
                                else
                                {
                                    num3 = queryResult.SeekToOffset(SeekReference.OriginCurrent, 1);
                                    num3 = 0;
                                }
                            }
                            else if (userContext.UserOptions.NextSelection == NextSelectionDirection.ReturnToView)
                            {
                                return(null);
                            }
                            num2--;
                            break;
                        }
                        num += num3;
                        if (messageModuleSearchViewState != null)
                        {
                            messageModuleSearchViewState.PageNumber = num / userContext.UserOptions.BasicViewRowCount + 1;
                        }
                        else
                        {
                            ListViewViewState listViewViewState = userContext.LastClientViewState as ListViewViewState;
                            if (listViewViewState != null && folderId.Equals(listViewViewState.FolderId))
                            {
                                listViewViewState.PageNumber = num / userContext.UserOptions.BasicViewRowCount + 1;
                            }
                        }
                        object[][] rows = queryResult.GetRows(1);
                        result = new ItemOperations.Result(((VersionedId)rows[0][0]).ObjectId, folderId);
                    }
                }
            }
            catch (ObjectNotFoundException)
            {
                result = null;
            }
            finally
            {
                if (folder != null)
                {
                    folder.Dispose();
                }
            }
            return(result);
        }