/// <summary>
		/// Do the real work for both smart Create methods.
		/// </summary>
		private ICmTranslation Create(ICollection<ICmTranslation> owningVector, ICmPossibility translationType)
		{
			var newbie = new CmTranslation();
			owningVector.Add(newbie);
			newbie.TypeRA = translationType;
			return newbie;
		}
Example #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Looks to see if we currently have a back translation, returning it if we do.  If no
		/// BT exists, a new one is created and returned.
		/// </summary>
		/// <returns>CmTranslation for the BT</returns>
		/// ------------------------------------------------------------------------------------
		public ICmTranslation GetOrCreateBT()
		{
			ICmTranslation trans = GetBT();
			if (trans == null)
			{
				// We don't want to create an undo task if there is one already open.
				IActionHandler ah = Cache.ServiceLocator.GetInstance<IActionHandler>();
				NonUndoableUnitOfWorkHelper.DoUsingNewOrCurrentUOW(ah, () =>
				{
					// we need to create an empty translation if one does not exist.
					trans = new CmTranslation();
					TranslationsOC.Add(trans);
					trans.TypeRA = Services.GetInstance<ICmPossibilityRepository>().GetObject(CmPossibilityTags.kguidTranBackTranslation);
				});
			}
			return trans;
		}