Summary description for InflAffixTemplateControl.
Inheritance: SIL.FieldWorks.Common.Controls.XmlView, XCore.IxCoreColleague
		/// <summary>
		/// factory method which creates the correct subclass based on the XML parameters
		/// </summary>
		/// <param name="inflAffixTemplateCtrl"></param>
		/// <param name="configuration"></param>
		/// <returns></returns>
		public static InflAffixTemplateMenuHandler Create(InflAffixTemplateControl inflAffixTemplateCtrl, XmlNode configuration)
		{
			InflAffixTemplateMenuHandler h = null;
			if(configuration != null)
			{
				XmlNode node = configuration.SelectSingleNode("menuHandler");
				if (node != null)
				{
					h = (InflAffixTemplateMenuHandler) SIL.Utils.DynamicLoader.CreateObject(node);
				}
			}
			if (h == null)			//no class specified, so just returned a generic InflAffixTemplateControl
				h = new InflAffixTemplateMenuHandler();
			h.InflAffixTemplate = (InflAffixTemplateControl) inflAffixTemplateCtrl;
			return h;
		}
		/// <summary>
		/// Therefore this method, called once we have a cache and object, is our first chance to
		/// actually create the embedded control.
		/// </summary>
		public override void FinishInit()
		{
			CheckDisposed();
			IWritingSystemContainer wsContainer = Cache.ServiceLocator.WritingSystems;
			bool fVernRTL = wsContainer.DefaultVernacularWritingSystem.RightToLeftScript;
			bool fAnalRTL = wsContainer.DefaultAnalysisWritingSystem.RightToLeftScript;
			System.Xml.XmlAttribute xa = ConfigurationNode.Attributes["layout"];
			// To properly fix LT-6239, we need to consider all four mixtures of directionality
			// involving the vernacular (table) and analysis (slot name) writing systems.
			// These four possibilities are marked RTL, LTRinRTL, RTLinLTR, and <nothing>.
			if (fVernRTL && fAnalRTL)
			{
				if (xa.Value.EndsWith("RTLinLTR") || xa.Value.EndsWith("LTRinRTL"))
					xa.Value = xa.Value.Substring(0, xa.Value.Length - 8);
				if (!xa.Value.EndsWith("RTL"))
					xa.Value += "RTL";		// both vern and anal are RTL
			}
			else if (fVernRTL && !fAnalRTL)
			{
				if (xa.Value.EndsWith("RTLinLTR"))
					xa.Value = xa.Value.Substring(0, xa.Value.Length - 8);
				else if (xa.Value.EndsWith("RTL") && !xa.Value.EndsWith("LTRinRTL"))
					xa.Value = xa.Value.Substring(0, xa.Value.Length - 3);
				if (!xa.Value.EndsWith("LTRinRTL"))
					xa.Value += "LTRinRTL";		// LTR anal name in RTL vern table
			}
			else if (!fVernRTL && fAnalRTL)
			{
				if (xa.Value.EndsWith("LTRinRTL"))
					xa.Value = xa.Value.Substring(0, xa.Value.Length - 8);
				else if (xa.Value.EndsWith("RTL"))
					xa.Value = xa.Value.Substring(0, xa.Value.Length - 3);
				if (!xa.Value.EndsWith("RTLinLTR"))
					xa.Value += "RTLinLTR";		// RTL anal name in LTR vern table
			}
			else
			{
				if (xa.Value.EndsWith("RTLinLTR") || xa.Value.EndsWith("LTRinRTL"))
					xa.Value = xa.Value.Substring(0, xa.Value.Length - 8);
				else if (xa.Value.EndsWith("RTL"))
					xa.Value = xa.Value.Substring(0, xa.Value.Length - 3);
				// both vern and anal are LTR (unmarked case)
			}
			var ctrl = new InflAffixTemplateControl((FdoCache)Mediator.PropertyTable.GetValue("cache"),
				Object.Hvo, ConfigurationNode, StringTbl);
			Control = ctrl;
			m_menuHandler = InflAffixTemplateMenuHandler.Create(ctrl, ConfigurationNode);
#if !Want
			m_menuHandler.Init(Mediator, null);
#else
			m_menuHandler.Init(null, null);
#endif
			ctrl.SetContextMenuHandler(m_menuHandler.ShowSliceContextMenu);
			ctrl.Mediator = Mediator;
			ctrl.SetStringTableValues(Mediator.StringTbl);
			if (ctrl.RootBox == null)
				ctrl.MakeRoot();
		}
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		protected virtual void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (m_isDisposed)
				return;

			if (disposing)
			{
				// Dispose managed resources here.
				if (m_clb != null)
				{
					m_clb.Dispose();
					m_clb = null;
				}
				m_rgfmi = null;
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_inflAffixTemplateCtrl = null;
			m_mediator = null;

			m_isDisposed = true;
		}