SIL.FieldWorks.XWorks.DTMenuHandler.GetSelectionHvoFromControls C# (CSharp) Method

GetSelectionHvoFromControls() private method

Gets the selection HVO from a slice control.
private GetSelectionHvoFromControls ( Slice slice ) : int
slice Slice The non-null slice to get the selection from.
return int
		private int GetSelectionHvoFromControls(Slice slice)
		{
			if (slice.Control == null || slice.Control.Controls.Count == 0) return 0;
			foreach (Control x in slice.Control.Controls)
			{
				if (x is RootSiteControl)
				{
					var site = x as SimpleRootSite;
					if (site != null && site.RootBox != null)
					{
						var tsi = new TextSelInfo(site.RootBox);
						return tsi.Hvo(true);
					}
				}
			}
			return 0; // no selection found
		}