protected void SaveCurrent(IParentList _o, string _path) { PropertyInfo pi = _o.GetType().GetProperty("Current"); if (pi == null) { return; } IParent o_current = pi.GetValue(_o, null) as IParent; if (o_current != null) { L.Add(_path + ".Current", o_current.PropertyIndex.ToString()); } }
void ListValue(object sender, EventArgs e) { GridItem g = propertyGrid2.SelectedGridItem; object val = g.Value; GridItem parent = g.Parent; PropertyInfo pi = parent.Value.GetType().GetProperty(g.PropertyDescriptor.Name); if (parent == null) { return; } IParentBase pval = parent.Value as IParentBase; if (pval == null) { return; } IParentList plist = pval.Parent as IParentList; if (plist == null) { return; } ConfirmAttribute cf = Attribute.GetCustomAttribute(pi, typeof(ConfirmAttribute)) as ConfirmAttribute; //if (cf != null) //{ // if (MessageBox.Show("Подтвердите изменения", "Внимание", MessageBoxButtons.OKCancel) == DialogResult.Cancel) // return; //} int count = plist.ListCount(); for (int i = 0; i < count; i++) { object lval = plist.GetItem(i); pi.SetValue(lval, val, null); } propertyGrid2.Refresh(); if (OnRefresh != null) { OnRefresh(); } }
public FLBase(object _L) { InitializeComponent(); L = _L as IParentList; parMainLite = (L as IParentBase).parMainLite; }