public static Primitive SetFocus(Primitive shapeName)
{
Type GraphicsWindowType = typeof(GraphicsWindow);
Dictionary<string, UIElement> _objectsMap;
UIElement obj;
try
{
_objectsMap = (Dictionary<string, UIElement>)GraphicsWindowType.GetField("_objectsMap", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase).GetValue(null);
if (!_objectsMap.TryGetValue((string)shapeName, out obj))
{
Utilities.OnShapeError(Utilities.GetCurrentMethod(), shapeName);
return "False";
}
InvokeHelperWithReturn ret = new InvokeHelperWithReturn(delegate { return obj.Focus(); });
return FastThread.InvokeWithReturn(ret).ToString();
}
catch (Exception ex)
{
Utilities.OnError(Utilities.GetCurrentMethod(), ex);
return "False";
}
}