public void SendUpdate(string varName) { BindingEventArgs args = new BindingEventArgs(varName); if (valueChanged != null) { valueChanged(this, args); } }
public void NotifyChange(object source, BindingEventArgs args) { Bindable changedObj, updateObj; string sourceVar, destVar; if (source.Equals(this.source)) { changedObj = this.source; updateObj = this.destination; sourceVar = this.sourceVarName; destVar = this.destVarName; } else { changedObj = this.destination; updateObj = this.source; sourceVar = this.destVarName; destVar = this.sourceVarName; } // First check whether the target variable is locked if (updateObj.VariableLocked(destVar)) { return; } // Currently wrong as it forces the source variable to be a T2 Type t2 = typeof(T2); PropertyInfo info = changedObj.GetType().GetProperty(sourceVar); T2 thingy = (T2)info.GetValue(changedObj, null); // Lock the variable (to avoid a recursive update once it has been set) and update updateObj.LockVariable(destVar); updateObj.SetVariable <T2>(destVar, (T2)changedObj.GetType().GetProperty(sourceVar).GetValue(changedObj, null)); updateObj.UnlockVariable(destVar); }