Пример #1
0
        /// <summary>
        /// Builds a code tree from the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>The built code tree, otherwise null.</returns>
        internal static SetCodeItems RetrieveCodeTree(CodeTreeRequest request)
        {
            ClearHierarchyInformation(request.RawCodeItems);

            SetCodeItems codeItems = null;

            switch (request.SortOrder)
            {
            case CodeSortOrder.Alpha:
                codeItems = OrganizeCodeItemsByAlphaSortOrder(request.RawCodeItems);
                break;

            case CodeSortOrder.File:
                codeItems = OrganizeCodeItemsByFileSortOrder(request.RawCodeItems);
                break;

            case CodeSortOrder.Type:
                codeItems = OrganizeCodeItemsByTypeSortOrder(request.RawCodeItems);
                break;
            }

            if (!string.IsNullOrWhiteSpace(request.NameFilter))
            {
                RecursivelyFilter(codeItems, request.NameFilter);
            }

            return(codeItems);
        }
Пример #2
0
 /// <summary>
 /// Builds a code tree asynchronously from the specified request.
 /// </summary>
 /// <param name="request">The request.</param>
 internal void RetrieveCodeTreeAsync(CodeTreeRequest request)
 {
     if (_bw.IsBusy)
     {
         _pendingRequest = request;
         _bw.CancelAsync();
     }
     else
     {
         _pendingRequest = null;
         _bw.RunWorkerAsync(request);
     }
 }