private static void OnStateSlotChanged(DependencyObject targetObject, NavigationContext context, string contextVariable)
 {
   if (string.IsNullOrEmpty(contextVariable))
   {
     WorkflowSaveRestoreStateAction action = GetSaveRestoreAction(targetObject);
     if (action != null)
     {
       action.DetachFromObject();
       RemoveSaveRestoreAction(targetObject);
     }
   }
   else
   {
     if (GetSaveRestoreAction(targetObject) != null)
       // Action already attached to object
       return;
     UIElement uiElement = targetObject as UIElement;
     WorkflowSaveRestoreStateAction action = new WorkflowSaveRestoreStateAction(context, contextVariable);
     SetSaveRestoreAction(targetObject, action);
     action.AttachToObject(uiElement);
   }
 }
 private static void OnStateSlotChanged(DependencyObject targetObject, NavigationContext context, string contextVariable)
 {
     if (string.IsNullOrEmpty(contextVariable))
     {
         WorkflowSaveRestoreStateAction action = GetSaveRestoreAction(targetObject);
         if (action != null)
         {
             action.DetachFromObject();
             RemoveSaveRestoreAction(targetObject);
         }
     }
     else
     {
         if (GetSaveRestoreAction(targetObject) != null)
         {
             // Action already attached to object
             return;
         }
         UIElement uiElement = targetObject as UIElement;
         WorkflowSaveRestoreStateAction action = new WorkflowSaveRestoreStateAction(context, contextVariable);
         SetSaveRestoreAction(targetObject, action);
         action.AttachToObject(uiElement);
     }
 }
        public void DeepCopy(IDeepCopyable source, ICopyManager copyManager)
        {
            WorkflowSaveRestoreStateAction w = (WorkflowSaveRestoreStateAction)source;

            _targetObject = copyManager.GetCopy(w._targetObject);
        }
 protected static void SetSaveRestoreAction(DependencyObject targetObject, WorkflowSaveRestoreStateAction value)
 {
     targetObject.SetAttachedPropertyValue(SAVE_RESTORE_ACTION_ATTACHED_PROPERTY, value);
 }
 protected static void SetSaveRestoreAction(DependencyObject targetObject, WorkflowSaveRestoreStateAction value)
 {
   targetObject.SetAttachedPropertyValue(SAVE_RESTORE_ACTION_ATTACHED_PROPERTY, value);
 }