private static bool UpdateProperties(IGXDLMSView view, System.Windows.Forms.Control.ControlCollection controls, GXDLMSObject target, int index, object value)
{
foreach (GXButton it in ActionList)
{
it.Click -= new EventHandler(OnAction);
}
ActionList.Clear();
bool found = false;
foreach (Control it in controls)
{
if (it is GXValueField)
{
GXValueField obj = it as GXValueField;
if (obj.Index == index)
{
obj.Target = target;
obj.UpdateValueItems(target, index, value);
obj.Value = value;
found = true;
}
}
else if (it is GXButton)
{
GXButton obj = it as GXButton;
bool enabled = target.GetMethodAccess(obj.Index) != MethodAccessMode.NoAccess;
obj.Enabled = enabled;
if (enabled)
{
obj.Target = target;
it.Click += new EventHandler(OnAction);
ActionList.Add(obj);
}
}
else if (it.Controls.Count != 0)
{
found = UpdateProperties(view, it.Controls, target, index, value);
}
if (found)
{
break;
}
}
return found;
}