public static UndoState FromObject(object recordFrom) { UndoState toReturn = new UndoState(); toReturn.Owner = recordFrom; var lateBinder = LateBinder.GetInstance(recordFrom.GetType()); object result; if(lateBinder.TryGetValue(recordFrom, "X", out result)) { toReturn.X = (float)result; } if (lateBinder.TryGetValue(recordFrom, "Y", out result)) { toReturn.Y = (float)result; } if (lateBinder.TryGetValue(recordFrom, "Z", out result)) { toReturn.Z = (float)result; } if (lateBinder.TryGetValue(recordFrom, "ScaleX", out result)) { toReturn.ScaleX = (float)result; } if (lateBinder.TryGetValue(recordFrom, "ScaleY", out result)) { toReturn.ScaleY = (float)result; } return toReturn; }
public static UndoState FromObject(object recordFrom) { UndoState toReturn = new UndoState(); toReturn.Owner = recordFrom; var lateBinder = LateBinder.GetInstance(recordFrom.GetType()); object result; if (lateBinder.TryGetValue(recordFrom, "X", out result)) { toReturn.X = (float)result; } if (lateBinder.TryGetValue(recordFrom, "Y", out result)) { toReturn.Y = (float)result; } if (lateBinder.TryGetValue(recordFrom, "Z", out result)) { toReturn.Z = (float)result; } if (lateBinder.TryGetValue(recordFrom, "ScaleX", out result)) { toReturn.ScaleX = (float)result; } if (lateBinder.TryGetValue(recordFrom, "ScaleY", out result)) { toReturn.ScaleY = (float)result; } return(toReturn); }
public UndoState GetDiff(object compareTo) { UndoState toReturn = new UndoState(); var lateBinder = LateBinder.GetInstance(compareTo.GetType()); object result = null; bool foundSomething = false; if (X.HasValue && lateBinder.TryGetValue(compareTo, "X", out result) && (float)result != X.Value) { toReturn.X = this.X; foundSomething = true; } if (Y.HasValue && lateBinder.TryGetValue(compareTo, "Y", out result) && (float)result != Y.Value) { toReturn.Y = this.Y; foundSomething = true; } if (Z.HasValue && lateBinder.TryGetValue(compareTo, "Z", out result) && (float)result != Z) { toReturn.Z = this.Z; foundSomething = true; } if (ScaleX.HasValue && lateBinder.TryGetValue(compareTo, "ScaleX", out result) && (float)result != ScaleX) { toReturn.ScaleX = this.ScaleX; foundSomething = true; } if (ScaleY.HasValue && lateBinder.TryGetValue(compareTo, "ScaleY", out result) && (float)result != ScaleY) { toReturn.ScaleY = this.ScaleY; foundSomething = true; } if (foundSomething) { toReturn.Owner = compareTo; return(toReturn); } else { return(null); } }
public UndoState GetDiff(object compareTo) { UndoState toReturn = new UndoState(); var lateBinder = LateBinder.GetInstance(compareTo.GetType()); object result = null; bool foundSomething = false; if (X.HasValue && lateBinder.TryGetValue(compareTo, "X", out result) && (float)result != X.Value) { toReturn.X = this.X; foundSomething = true; } if (Y.HasValue && lateBinder.TryGetValue(compareTo, "Y", out result) && (float)result != Y.Value) { toReturn.Y = this.Y; foundSomething = true; } if (Z.HasValue && lateBinder.TryGetValue(compareTo, "Z", out result) && (float)result != Z) { toReturn.Z = this.Z; foundSomething = true; } if (ScaleX.HasValue && lateBinder.TryGetValue(compareTo, "ScaleX", out result) && (float)result != ScaleX) { toReturn.ScaleX = this.ScaleX; foundSomething = true; } if (ScaleY.HasValue && lateBinder.TryGetValue(compareTo, "ScaleY", out result) && (float)result != ScaleY) { toReturn.ScaleY = this.ScaleY; foundSomething = true; } if (foundSomething) { toReturn.Owner = compareTo; return toReturn; } else { return null; } }
public void SaveSnapshot(object selectedObject) { mCurrentSnapshot = UndoState.FromObject(selectedObject); }
public void Clear() { mUndos = new List<UndoState>(); mCurrentSnapshot = null; }
public void Clear() { mUndos = new List <UndoState>(); mCurrentSnapshot = null; }