Пример #1
0
        internal override bool EnsureIsValid(DefaultFolderContext context, Folder folder)
        {
            FromFavoriteSendersFolderValidation.Tracer.TraceFunction((long)this.GetHashCode(), "Entering FromFavoriteSendersFolderValidation.EnsureIsValid");
            if (!base.EnsureIsValid(context, folder))
            {
                FromFavoriteSendersFolderValidation.Tracer.TraceFunction((long)this.GetHashCode(), "Exiting FromFavoriteSendersFolderValidation.EnsureIsValid:  folder failed base class validation.");
                return(false);
            }
            SearchFolder searchFolder = folder as SearchFolder;

            if (searchFolder == null)
            {
                FromFavoriteSendersFolderValidation.Tracer.TraceFunction((long)this.GetHashCode(), "Exiting FromFavoriteSendersFolderValidation.Validate:  not a SearchFolder instance.");
                return(false);
            }
            SearchFolderCriteria searchFolderCriteria = SearchFolderValidation.TryGetSearchCriteria(searchFolder);
            SearchFolderCriteria searchCriteria       = FromFavoriteSendersFolderValidation.GetSearchCriteria(context);

            if (searchFolderCriteria == null || !SearchFolderValidation.MatchSearchFolderCriteria(searchFolderCriteria, searchCriteria) || searchFolderCriteria.DeepTraversal != searchCriteria.DeepTraversal)
            {
                FromFavoriteSendersFolderValidation.Tracer.TraceDebug((long)this.GetHashCode(), "Current criteria are NOT initialized or don't match desired criteria.  Updating.");
                searchFolder.ApplyContinuousSearch(searchCriteria);
            }
            FromFavoriteSendersFolderValidation.Tracer.TraceFunction((long)this.GetHashCode(), "Exiting FromFavoriteSendersFolderValidation.EnsureIsValid.  Validation is done.");
            return(true);
        }
Пример #2
0
        private static bool VerifyAndFixSearchFolder(DefaultFolderContext context, SearchFolder folder)
        {
            SearchFolderCriteria searchFolderCriteria  = SearchFolderValidation.TryGetSearchCriteria(folder);
            SearchFolderCriteria searchFolderCriteria2 = AllItemsFolderValidation.CreateSearchCriteria(context);

            if (searchFolderCriteria == null || !SearchFolderValidation.MatchSearchFolderCriteria(searchFolderCriteria, searchFolderCriteria2))
            {
                AllItemsFolderValidation.TryApplyContinuousSearch(folder, searchFolderCriteria2);
            }
            return(true);
        }
Пример #3
0
 private static void TryApplyContinuousSearch(SearchFolder folder, SearchFolderCriteria criteria)
 {
     try
     {
         folder.ApplyContinuousSearch(criteria);
     }
     catch (QueryInProgressException)
     {
         SearchFolderCriteria searchFolderCriteria = SearchFolderValidation.TryGetSearchCriteria(folder);
         if (searchFolderCriteria == null || !SearchFolderValidation.MatchSearchFolderCriteria(criteria, searchFolderCriteria))
         {
             throw;
         }
     }
 }
Пример #4
0
        internal override bool EnsureIsValid(DefaultFolderContext context, Folder folder)
        {
            if (!base.EnsureIsValid(context, folder) || !(folder is SearchFolder))
            {
                return(false);
            }
            SearchFolder         searchFolder         = (SearchFolder)folder;
            SearchFolderCriteria searchFolderCriteria = CalendarVersionStoreValidation.CreateCalendarVersionSearchCriteria(context);
            SearchFolderCriteria searchCriteria       = searchFolder.GetSearchCriteria();

            if (!SearchFolderValidation.MatchSearchFolderCriteria(searchCriteria, searchFolderCriteria))
            {
                searchFolder.ApplyContinuousSearch(searchFolderCriteria);
            }
            return(true);
        }
Пример #5
0
 private static bool IsReminderSearchFolderForO11(DefaultFolderContext context, SearchFolderCriteria currentCriteria)
 {
     ExTraceGlobals.DefaultFoldersTracer.TraceDebug <SearchFolderCriteria>(-1L, "RemindersSearchFolderValidation::IsReminderSearchFolderForO11. We are checking currentCriteria on the folder we found. currentCriteria = {0}.", currentCriteria);
     return(SearchFolderValidation.MatchSearchFolderCriteria(currentCriteria, RemindersSearchFolderValidation.CreateRemindersQueryForO11(context)));
 }