protected override void Dispose(bool disposing)
		{
			// Must not be run more than once.
			if (IsDisposed)
				return;

			base.Dispose(disposing);

			if (disposing)
			{
			}

			m_template = null;
			m_sStem = null;
			m_sSlotChooserTitle = null;
			m_sSlotChooserInstructionalText = null;
			m_sObligatorySlot = null;
			m_sOptionalSlot = null;
			m_sNewSlotName = null;
			m_sUnnamedSlotName = null;
			m_sInflAffixChooserTitle = null;
			m_sInflAffixChooserInstructionalTextReq = null;
			m_sInflAffixChooserInstructionalTextOpt = null;
			m_sInflAffix = null;
		}
		public InflAffixTemplateControl(FdoCache cache, int hvoRoot, XmlNode xnSpec, StringTable stringTable)
			: base(hvoRoot, XmlUtils.GetAttributeValue(xnSpec, "layout"), stringTable, true)
		{
			m_xnSpec = xnSpec["deParams"];
			Cache = cache;
			m_template = Cache.ServiceLocator.GetInstance<IMoInflAffixTemplateRepository>().GetObject(m_hvoRoot);
		}
		protected override void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			base.Dispose(disposing);

			if (disposing)
			{
			}

			m_template = null;
			m_sStem = null;
			m_sSlotChooserTitle = null;
			m_sSlotChooserInstructionalText = null;
			m_sObligatorySlot = null;
			m_sOptionalSlot = null;
			m_sNewSlotName = null;
			m_sUnnamedSlotName = null;
			m_sInflAffixChooserTitle = null;
			m_sInflAffixChooserInstructionalTextReq = null;
			m_sInflAffixChooserInstructionalTextOpt = null;
			m_sInflAffix = null;
		}
		public InflAffixTemplateControl(FdoCache cache, int hvoRoot, XmlNode xnSpec, StringTable stringTable)
			: base(hvoRoot, XmlUtils.GetAttributeValue(xnSpec, "layout"), stringTable, true)
		{
			m_xnSpec = xnSpec["deParams"];
			Cache = cache;
			m_template = new MoInflAffixTemplate(cache, m_hvoRoot);
		}
		private static XElement ExportAffixtemplate(IMoInflAffixTemplate template, Icu.UNormalizationMode mode)
		{
			return new XElement("MoInflAffixTemplate",
								new XAttribute("Id", template.Hvo),
								new XAttribute("Final", template.Final),
								ExportBestAnalysis(template.Name, "Name", mode),
								ExportBestAnalysis(template.Description, "Description", mode),
								  from slot in template.SlotsRS where IsValidSlot(slot)
								   select ExportItemAsReference(slot, template.SlotsRS.IndexOf(slot), "Slots"),
								  from pfxslot in template.PrefixSlotsRS where IsValidSlot(pfxslot)
								   select ExportItemAsReference(pfxslot, template.PrefixSlotsRS.IndexOf(pfxslot), "PrefixSlots"),
								  from sfxslot in template.SuffixSlotsRS where IsValidSlot(sfxslot)
								   select ExportItemAsReference(sfxslot, template.PrefixSlotsRS.IndexOf(sfxslot), "SuffixSlots"));
		}
		/// <summary>
		/// Return true if this is considered a valid template, worth exporting for the various grammar tools.
		/// Currently this means at least one of its main slots is valid.
		/// </summary>
		static bool IsValidTemplate(IMoInflAffixTemplate template)
		{
			if (template.Disabled)
				return false;
			return
				(from affixSlot in template.PrefixSlotsRS.Concat(template.SuffixSlotsRS)
				 where IsValidSlot(affixSlot)
				 select affixSlot).Take(1).Any();
		}
示例#7
0
		private IMoInflAffixSlot AddSlot(IMoInflAffixTemplate template, string name, bool prefix, bool optional)
		{
			IMoInflAffixSlot slot = Cache.ServiceLocator.GetInstance<IMoInflAffixSlotFactory>().Create();
			template.OwnerOfClass<IPartOfSpeech>().AffixSlotsOC.Add(slot);
			slot.Name.SetAnalysisDefaultWritingSystem(name);
			slot.Optional = optional;
			if (prefix)
				template.PrefixSlotsRS.Add(slot);
			else
				template.SuffixSlotsRS.Add(slot);
			return slot;
		}