void FindDrawers() { var methods = this.GetType().GetMethods().Where(m => m.GetCustomAttributes(typeof(vItemDrawerToolBarAttribute), true).Length > 0).ToArray(); itemToolBars = new List <ToolBars>(); itemToolBars.Add(new ToolBars("Properties", new OnDrawItem(DrawAllProperties))); for (int i = 0; i < methods.Length; i++) { string title = (methods[i].GetCustomAttributes(typeof(vItemDrawerToolBarAttribute), true)[0] as vItemDrawerToolBarAttribute).title; OnDrawItem onDraw = (OnDrawItem)Delegate.CreateDelegate(typeof(OnDrawItem), this, methods[i]); itemToolBars.Add(new ToolBars(title, onDraw)); } }
public ToolBars(string title, OnDrawItem onDraw) { this.title = title; this.onDraw = onDraw; }