public bool DoAction(int i) { if (i < 0 || i >= actions.Count) { return(false); } ActionDescriptor action = actions [i]; if (action.Pattern == null) { return(false); } try { action.Delegate(action.Pattern); return(true); } catch (ElementNotEnabledException) { return(false); } }