Exemple #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Writes this category to the the specified annotation, creating a new category if
        /// needed.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        internal void WriteToCache(IScrScriptureNote ann)
        {
            int ws = (string.IsNullOrEmpty(IcuLocale) ? ann.Cache.DefaultAnalWs :
                      ScrNoteImportManager.GetWsForLocale(IcuLocale));

            ICmPossibility category;

            if (CategoryPath.IndexOf(StringUtils.kChObject) != -1)
            {
                // The category specified the full path of the category possibility.
                category = ann.Cache.LangProject.TranslatedScriptureOA.NoteCategoriesOA.FindOrCreatePossibility(
                    CategoryPath, ws);
            }
            else
            {
                // The category does not contain a delimiter, so we may need to search
                // the entire possibility tree for a matching category in case it is a
                // sub-possibility.
                category = ann.Cache.LangProject.TranslatedScriptureOA.NoteCategoriesOA.FindOrCreatePossibility(
                    CategoryPath, ws, false);
            }

            IFdoReferenceSequence <ICmPossibility> categoryList = ann.CategoriesRS;

            if (!categoryList.Contains(category))
            {
                categoryList.Add(category);
            }
        }
Exemple #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets the sequence of selected possibilities
		/// </summary>
		/// <param name="listToUpdate">Sequence of possibilities. All possibilities that may be in
		/// this list get deleted and the new ones added.</param>
		/// <returns>True if the sequence was changed, false otherwise</returns>
		/// ------------------------------------------------------------------------------------
		public bool GetPossibilities(IFdoReferenceSequence<ICmPossibility> listToUpdate)
		{
			CheckDisposed();

			Debug.Assert(listToUpdate != null);
			Guid[] origGuids = listToUpdate.ToGuidArray();

			// Clear the list first.
			listToUpdate.Clear();

			bool fAllItemsAreTheSame = true;
			int i = 0;
			foreach (ICmPossibility newPoss in tvPossibilities.SelectedPossibilities)
			{
				listToUpdate.Add(newPoss);
				fAllItemsAreTheSame &= (i < origGuids.Length && origGuids[i++] != newPoss.Guid);
			}

			return (!fAllItemsAreTheSame || i != origGuids.Length);
		}