Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
Fix Unit Tests & Value Restore on .NET Properties
Browse files Browse the repository at this point in the history
  • Loading branch information
jogibear9988 committed Jun 28, 2015
1 parent 93f7bc2 commit 1d9266c
Showing 1 changed file with 16 additions and 13 deletions.
Expand Up @@ -132,7 +132,12 @@ public override string TextValue
return null;
}
}


internal void SetValueOnInstance(object value)
{
_property.ValueOnInstance = value;
}

// There may be multiple XamlModelProperty instances for the same property,
// so this class may not have any mutable fields / events - instead,
// we forward all event handlers to the XamlProperty.
Expand Down Expand Up @@ -195,13 +200,8 @@ public override string TextValue
_property.IsSetChanged -= value;
}
}

public override void SetValue(object value)
{
SetValue(value, false);
}

private void SetValue(object value, bool withoutUndo)
{
XamlPropertyValue newValue;
if (value == null) {
Expand All @@ -223,7 +223,7 @@ private void SetValue(object value, bool withoutUndo)
}

UndoService undoService = _designItem.Services.GetService<UndoService>();
if (undoService != null && !withoutUndo)
if (undoService != null)
undoService.Execute(new PropertyChangeAction(this, newValue, true));
else
SetValueInternal(newValue);
Expand Down Expand Up @@ -308,12 +308,15 @@ public void Undo()
}
}
else {
try {
property.SetValue(oldValueOnInstance, true);
if (property.DependencyProperty == null) {
try
{
property.SetValueOnInstance(oldValueOnInstance);
}
catch(Exception)
{ }
}
catch(Exception)
{ }


property.ResetInternal();
}
}
Expand Down

0 comments on commit 1d9266c

Please sign in to comment.