示例#1
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(FdoReferenceSequence <ICmPossibility> listToUpdate)
        {
            CheckDisposed();

            Debug.Assert(listToUpdate != null);
            int[] origHvos = listToUpdate.HvoArray;

            // Clear the list first. Don't use RemoveAll in case the action needs
            // to be undone. RemoveAll dosesn't allow undo.
            while (listToUpdate.Count > 0)
            {
                listToUpdate.RemoveAt(0);
            }

            List <int> newHvos = tvPossibilities.SelectedHvos;
            bool       fSame   = (origHvos.Length == newHvos.Count);

            for (int i = 0; i < newHvos.Count; i++)
            {
                listToUpdate.Append(newHvos[i]);
                if (fSame && origHvos[i] != newHvos[i])
                {
                    fSame = false;
                }
            }

            return(fSame);
        }
示例#2
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));

            int hvo;

            if (CategoryPath.IndexOf(StringUtils.kchObject) != -1)
            {
                // The category specified the full path of the category possibility.
                hvo = 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.
                hvo = ann.Cache.LangProject.TranslatedScriptureOA.NoteCategoriesOA.FindOrCreatePossibility(
                    CategoryPath, ws, false);
            }

            FdoReferenceSequence <ICmPossibility> categoryList = ann.CategoriesRS;

            if (!categoryList.Contains(hvo))
            {
                categoryList.Append(hvo);
            }
        }
示例#3
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(FdoReferenceSequence<ICmPossibility> listToUpdate)
		{
			CheckDisposed();

			Debug.Assert(listToUpdate != null);
			int[] origHvos = listToUpdate.HvoArray;

			// Clear the list first. Don't use RemoveAll in case the action needs
			// to be undone. RemoveAll dosesn't allow undo.
			while (listToUpdate.Count > 0)
				listToUpdate.RemoveAt(0);

			List<int> newHvos = tvPossibilities.SelectedHvos;
			bool fSame = (origHvos.Length == newHvos.Count);

			for (int i = 0; i < newHvos.Count; i++)
			{
				listToUpdate.Append(newHvos[i]);
				if (fSame && origHvos[i] != newHvos[i])
					fSame = false;
			}

			return fSame;
		}