public static ClientActionControl Action(this ClientLogicalControl control, string actionCaption) { try { return(control.ContainedControls.OfType <ClientActionControl>().First(c => c.Caption.Replace("&", "").EndsWith(actionCaption))); } catch (InvalidOperationException exception) { control.WriteControlCaptions <ClientActionControl>(); throw new ArgumentOutOfRangeException(string.Format("Could not find an Action with caption {0}", actionCaption), exception); } }
public static ClientLogicalControl Control(this ClientLogicalControl control, string controlCaption) { try { return(control.ContainedControls.First(c => c.Caption.Replace("&", "").EndsWith(controlCaption) && (c.GetType() != typeof(ClientActionControl)))); } catch (InvalidOperationException exception) { control.WriteControlCaptions <ClientLogicalControl>(); throw new ArgumentOutOfRangeException(string.Format("Could not find a control with caption {0}", controlCaption), exception); } }
public static ClientLogicalControl Control(this ClientLogicalControl control, string controlCaption) { try { return(control .ContainedControls .First(c => c.HasCaption(controlCaption))); } catch (InvalidOperationException exception) { control.WriteControlCaptions <ClientLogicalControl>(); throw new ArgumentOutOfRangeException(string.Format("Could not find a control with caption {0}", controlCaption), exception); } }