/// <summary> /// Try to find a WfiWordform object corresponding the the focus selection. /// If successful return its guid, otherwise, return Guid.Empty. /// </summary> /// <returns></returns> internal static Guid ActiveWordform(LcmCache cache, PropertyTable propertyTable) { IApp app = propertyTable.GetValue <IApp>("App"); if (app == null) { return(Guid.Empty); } IFwMainWnd window = app.ActiveMainWindow as IFwMainWnd; if (window == null) { return(Guid.Empty); } IRootSite activeView = window.ActiveView; if (activeView == null) { return(Guid.Empty); } List <IVwRootBox> roots = activeView.AllRootBoxes(); if (roots.Count < 1) { return(Guid.Empty); } SelectionHelper helper = SelectionHelper.Create(roots[0].Site); if (helper == null) { return(Guid.Empty); } ITsString word = helper.SelectedWord; if (word == null || word.Length == 0) { return(Guid.Empty); } #if WANTPORT // FWR-2784 int hvoWordform = cache.LangProject.WordformInventoryOA.GetWordformId(word); if (hvoWordform == 0 || cache.IsDummyObject(hvoWordform)) { return(Guid.Empty); } return(cache.GetGuidFromId(hvoWordform)); #else return(Guid.Empty); #endif }