SIL.FieldWorks.XWorks.MorphologyEditor.InflAffixTemplateControl.HandleInsert C# (CSharp) Method

HandleInsert() private method

private HandleInsert ( bool fBefore ) : void
fBefore bool
return void
		private void HandleInsert(bool fBefore)
		{
			bool fIsPrefixSlot = GetIsPrefixSlot(fBefore);
			using (SimpleListChooser chooser = MakeChooserWithExtantSlots(fIsPrefixSlot))
			{
				chooser.ShowDialog(this);
				if (chooser.ChosenOne != null)
				{
					var chosenSlot = chooser.ChosenOne.Object as IMoInflAffixSlot;
					int flid = 0;
					int ihvo = -1;
					if (m_obj.ClassID == MoInflAffixSlotTags.kClassId)
					{
						HandleInsertAroundSlot(fBefore, chosenSlot, out flid, out ihvo);
					}
					else if (m_obj.ClassID == MoInflAffixTemplateTags.kClassId)
					{
						HandleInsertAroundStem(fBefore, chosenSlot, out flid, out ihvo);
					}
					m_rootb.Reconstruct(); // Ensure that the table gets redrawn
					if (chooser.LinkExecuted)
					{
						// Select the header of the newly added slot in case the user wants to edit it.
						// See LT-8209.
						SelLevInfo[] rgvsli = new SelLevInfo[1];
						rgvsli[0].hvo = chosenSlot.Hvo;
						rgvsli[0].ich = -1;
						rgvsli[0].ihvo = ihvo;
						rgvsli[0].tag = flid;
						m_rootb.MakeTextSelInObj(0, 1, rgvsli, 0, null, true, true, true, false, true);
					}
#if CausesDebugAssertBecauseOnlyWorksOnStTexts
					RefreshDisplay();
#endif
				}
			}
		}