public IUndoableEdit CreateChangeRiskLevelEdit(IRiskLevelObject riskLevelObject, int riskLevel) { DefaultEdit <object> pe = new DefaultEdit <object>(riskLevelObject, ChangeRiskLevel, ChangeRiskLevel); pe.UndoParams = new PropertyEditParameters("", riskLevelObject.RiskLevel); pe.RedoParams = new PropertyEditParameters("", riskLevel); return(pe); }
public IUndoableEdit CreateChangeStateEdit(IStateObject stateObject, State state) { DefaultEdit <object> pe = new DefaultEdit <object>(stateObject, ChangeState, ChangeState); pe.UndoParams = new PropertyEditParameters("", stateObject.CurrentState); pe.RedoParams = new PropertyEditParameters("", state); return(pe); }
public IUndoableEdit CreateChangePropertyEdit(object owner, string property, object value) { //get the original value Type type = owner.GetType(); PropertyInfo pinfo = type.GetProperty(property); object oldvalue = pinfo.GetValue(owner, null); DefaultEdit <object> pe = new DefaultEdit <object>(owner, ChangeProperty, ChangeProperty); pe.UndoParams = new PropertyEditParameters(property, oldvalue); pe.RedoParams = new PropertyEditParameters(property, value); return(pe); }