Ejemplo n.º 1
0
		public void Redo()
		{
			if (redoStack.Count>0)
			{
				PropertyValue pVal = (PropertyValue)redoStack.Pop();
				Type compType = objParent.GetType();
				PropertyInfo pinfo = compType.GetProperty(pVal.PropertyName);

				//first get the existing value and push to undo stack
				object oldVal = pinfo.GetValue(objParent,null);
				PropertyValue pUndo = new PropertyValue(pVal.PropertyName, oldVal);
				undoStack.Push(pUndo);			
				// apply the value that was popped off the redo stack
				pinfo.SetValue(objParent,pVal.Value, null);
			}
		}
Ejemplo n.º 2
0
		/// <summary>
		/// This method would be called by the parent class
		/// in order to store the value of a property prior
		/// to it being changed
		/// </summary>
		/// <param name="propName">Name of the property</param>
		/// <param name="propVal">The value prior to change</param>
		public void Store (string propName, object propVal)
		{
			PropertyValue pVal = new PropertyValue(propName, propVal);
			undoStack.Push(pVal);
		}