SIL.FieldWorks.FdoUi.PartOfSpeechUi.CreateNewUiObject C# (CSharp) Method

CreateNewUiObject() public static method

Handle the context menu for inserting a POS.
public static CreateNewUiObject ( XCore.Mediator mediator, int classId, int hvoOwner, int flid, int insertionPosition ) : PartOfSpeechUi
mediator XCore.Mediator
classId int
hvoOwner int
flid int
insertionPosition int
return PartOfSpeechUi
		public new static PartOfSpeechUi CreateNewUiObject(Mediator mediator, int classId, int hvoOwner, int flid, int insertionPosition)
		{
			PartOfSpeechUi posUi = null;
			using (MasterCategoryListDlg dlg = new MasterCategoryListDlg())
			{
				FdoCache cache = (FdoCache)mediator.PropertyTable.GetValue("cache");
				Debug.Assert(cache != null);
				var newOwner = cache.ServiceLocator.GetInstance<IPartOfSpeechRepository>().GetObject(hvoOwner);
				dlg.SetDlginfo(newOwner.OwningList, mediator, true, newOwner);
				switch (dlg.ShowDialog((Form)mediator.PropertyTable.GetValue("window")))
				{
					case DialogResult.OK: // Fall through.
					case DialogResult.Yes:
						posUi = new PartOfSpeechUi(dlg.SelectedPOS);
						mediator.SendMessage("JumpToRecord", dlg.SelectedPOS.Hvo);
						break;
				}
			}
			return posUi;
		}