public void SetValue(object value, bool alreadyRunning = false) { if (BindedField != null && BindedProperty == null) { if (m_newValue == null && !alreadyRunning) { BindedField.SetValue(Instance, value); } else if (Attribute.DefinableRunning) { BindedField.SetValue(Instance, value); } m_newValue = value; } else if (BindedProperty != null && BindedField == null) { if (m_newValue == null && !alreadyRunning) { BindedProperty.SetValue(Instance, value, new object[0]); } else if (Attribute.DefinableRunning) { BindedProperty.SetValue(Instance, value, new object[0]); } m_newValue = value; } }
/// <summary> /// Read the element as it should appears in the xml file /// </summary> /// <returns></returns> /// <remarks>The return value can be differant from the field value</remarks> public object GetValue(bool realValue = false) { if (BindedField != null && BindedProperty == null) { if (!realValue && m_newValue != null && !Attribute.DefinableRunning) { return(m_newValue); } return(BindedField.GetValue(Instance)); } else if (BindedProperty != null && BindedField == null) { if (!realValue && m_newValue != null && !Attribute.DefinableRunning) { return(m_newValue); } return(BindedProperty.GetValue(Instance, new object[0])); } throw new Exception(string.Format("Cannot read the config node '{0}' because no member has been bind to it", Path)); }