Esempio n. 1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Implement CreateTestData, called by InMemoryFdoTestBase set up.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void CreateTestData()
		{
			var servloc = Cache.ServiceLocator;

			ICmPossibilityFactory possibilityFactory = servloc.GetInstance<ICmPossibilityFactory>();
			// Add an annotation category (for Discourse)
			m_categoryDiscourse = possibilityFactory.Create();
			var affixCatList = servloc.GetInstance<ICmPossibilityListFactory>().Create();
			Cache.LangProject.AffixCategoriesOA = affixCatList;
			affixCatList.PossibilitiesOS.Add(m_categoryDiscourse);

			// Add an annotation category (for Grammar)
			m_categoryGrammar = possibilityFactory.Create();
			affixCatList.PossibilitiesOS.Add(m_categoryGrammar);

			// add a sub-annotation category (for "Pronominal reference")
			m_categoryGrammar_PronominalRef = possibilityFactory.Create();
			m_categoryGrammar.SubPossibilitiesOS.Add(m_categoryGrammar_PronominalRef);

			// Set up a filter, with a CmCell we can test on.
			ICmFilter filter = servloc.GetInstance<ICmFilterFactory>().Create();
			Cache.LangProject.FiltersOC.Add(filter);
			ICmRow row = servloc.GetInstance<ICmRowFactory>().Create();
			filter.RowsOS.Add(row);
			m_cell = servloc.GetInstance<ICmCellFactory>().Create();
			row.CellsOS.Add(m_cell);
		}
Esempio n. 2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initialize the filter so it can check for matches in reference collections.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void InitReferenceCriteria(ICmCell cell, int filteredFlid)
		{
			cell.ParseObjectMatchCriteria();

			if (cell is CmCell && ((CmCell)cell).MatchOnlyEmptyRefCollection)
				return;

			// Do we need to prompt the user for the value he wants to match?
			if (cell.MatchValue == 0 || ShowPrompt == 1)
			{
				throw new NotImplementedException("Need to implement prompting the user for filter information");
				// Prompt the user for a possibility.
				//Debug.Assert(m_possSupplier != null);
				//int hvoPossList = m_userView.GetPossibilityListForProperty(filteredFlid);
				//if (hvoPossList == 0)
				//    throw new Exception("Couldn't find appropriate Possibility List to prompt for filter criteria");

				//// The possibility supplier actually displays the Chooser dialog to prompt the user.
				//ICmPossibility pss = m_possSupplier.GetPossibility((CmPossibilityList)Services.GetObject(hvoPossList),
				//    (CmPossibility)Services.GetObject(cell.MatchValue));
				//if (pss == null)
				//    throw new Exception("User cancelled Filter");

				//cell.MatchValue = pss.Hvo;
			}
		}
Esempio n. 3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initialize the filter so it can check for matches in reference collections.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void InitReferenceCriteria(ICmCell cell, int filteredFlid)
		{
			cell.ParseObjectMatchCriteria();

			if (cell is CmCell && ((CmCell)cell).MatchOnlyEmptyRefCollection)
				return;

			// Do we need to prompt the user for the value he wants to match?
			if (cell.MatchValue == 0 || ShowPrompt == 1)
			{
				// Prompt the user for a possibility.
				Debug.Assert(m_userView != null);
				Debug.Assert(m_possSupplier != null);
				int hvoPossList = m_userView.GetPossibilityListForProperty(filteredFlid);
				if (hvoPossList == 0)
					throw new Exception("Couldn't find appropriate Possibility List to prompt for filter criteria");

				// The possibility supplier actually displays the Chooser dialog to prompt the user.
				int hvoPoss = m_possSupplier.GetPossibility(
					new CmPossibilityList(m_cache, hvoPossList), cell.MatchValue);

				if (hvoPoss == 0)
					throw new Exception("User cancelled Filter");

				cell.MatchValue = hvoPoss;
			}
		}