コード例 #1
0
        private void QueueUploaders()
        {
            int sequence = 1;

            foreach (var item in ToolkitUtilities.GetPreorder <LocalTaxonomyItem>(this.localTermStore, x => x.ChildItems)
                     )
            {
                this.CheckForUnimplementedSyncActions(item);

                TaxonomyItemUploader uploader = this.CreateUploader(item);

                if (uploader == null)
                {
                    continue;
                }

                uploader.ControllerKey.Started = false;
#if false
                // FOR DEBUGGING, BLOCK AS MUCH AS POSSIBLE
                uploader.ControllerKey.Sequence = -sequence;
#else
                uploader.ControllerKey.Sequence = sequence;
#endif
                ++sequence;
            }

            foreach (var uploader in this.queuedUploaders.EnumerateUnordered())
            {
                uploader.Initialize();
            }
        }
コード例 #2
0
 /// <summary>
 /// Enumerates every term that belongs to this term set.
 /// </summary>
 public IEnumerable <LocalTerm> GetAllTerms()
 {
     foreach (
         LocalTaxonomyItem item in
         ToolkitUtilities.GetPreorder((LocalTaxonomyItem)this, item => item.ChildItems))
     {
         if (item == this)
         {
             continue;
         }
         yield return((LocalTerm)item);
     }
 }
コード例 #3
0
        private void AddSubtreeToTable(LocalTaxonomyItem rootItem)
        {
            foreach (LocalTaxonomyItem localItem in ToolkitUtilities.GetPreorder(rootItem,
                                                                                 (LocalTaxonomyItem x) => x.ChildItems))
            {
                LocalTerm localTerm = localItem as LocalTerm;
                if (localTerm != null && localItem.Id != Guid.Empty)
                {
                    // Add localTerm to the table
                    List <LocalTerm> termList = null;
                    if (!this.termsByGuid.TryGetValue(localTerm.Id, out termList))
                    {
                        // Create the missing list
                        termList = new List <LocalTerm>();
                        this.termsByGuid.Add(localTerm.Id, termList);
                    }

                    // Add the localTerm to the list
                    if (localTerm.IsSourceTerm)
                    {
                        for (int i = 0; i < termList.Count; ++i)
                        {
                            if (termList[i].IsSourceTerm)
                            {
                                throw new InvalidOperationException(string.Format(
                                                                        "The term \"{0}\" cannot be the source term in two different term sets (TermId={1})",
                                                                        localTerm.Name, localTerm.Id));
                            }
                        }
                        // Source term is first in the list
                        termList.Insert(0, localTerm);
                    }
                    else
                    {
                        termList.Add(localTerm);
                    }
                }
            }
        }