public virtual IConfigCtrl CreateCtrl(Converter <IConfig, IConfigCtrl> factory) { if (factory == null) { return(null); } m_Ctrl = factory(this); return(m_Ctrl); }
public static IConfigCtrl GetConfigCtrlRoot(Control control) { //Find first IConfigCtrl parent in hierarchy IConfigCtrl root = control as IConfigCtrl; Control parent = control.Parent; while (parent != null) { if (parent is IConfigCtrl) { root = parent as IConfigCtrl; } parent = parent.Parent; } return(root); }
public IConfigCtrl FindControlOfType(Type type) { //Get ConfigCtrl Root IConfigCtrl parent = GetConfigCtrlRoot(this); if (parent == null) { return(null); } //Collect all IConfigCtrls from Root and it's childs and their childs, etc. var configCtrls = GetConfigCtrlChilds(parent as Control); foreach (IConfigCtrl control in configCtrls) { if (control.GetType() == type) { return(control); } } return(null); }