Example #1
0
 private void Push(T item)
 {
     Debug.Assert(_stack.Count == 0 || _stack[_stack.Count - 1] != item);
     _stack.Add(item);
     NotifyOfPropertyChange("Previous");
     if (_stack.Count == 2)
     {
         GoBackCmd.RaiseCanExecuteChanged(_goBackCommand);
     }
 }
Example #2
0
 private void Pop()
 {
     Debug.Assert(_stack.Count > 1, "We never pop the root page.");
     _stack.RemoveAt(_stack.Count - 1);
     NotifyOfPropertyChange("Previous");
     if (_stack.Count == 1)
     {
         GoBackCmd.RaiseCanExecuteChanged(_goBackCommand);
     }
 }
Example #3
0
            static public GoBackCmd Ensure(StackConductor <T> holder, ref WeakReference <GoBackCmd> cmdRef)
            {
                GoBackCmd cmd;

                if (cmdRef == null)
                {
                    cmdRef = cmd = new GoBackCmd(holder);
                }
                else if ((cmd = cmdRef.Target) == null)
                {
                    cmdRef.Target = cmd = new GoBackCmd(holder);
                }
                return(cmd);
            }