示例#1
0
 public bool SetCurrentPosition(DirectoryPosition pos)
 {
     try
     {
         VFS.FullPath = pos.Path;
         var vm = TryCreateViewModel(pos.Path.Last());
         if (null == vm)
         {
             return(false);
         }
         ViewModel = vm;
         if (null != pos.Item)
         {
             lv_SelectItem(pos.Item);
         }
         return(true);
     }
     catch (Exception X)
     {
         // if VFS.FullPath throws an exception, ViewModel becomes inconsistent at this point
         // and should be rebuilt
         ViewModel = CreateViewModel(VFS.Top.CurrentDirectory, true);
         SetStatusText(X.Message);
         return(false);
     }
 }
示例#2
0
        private void GoForwardExec(object sender, ExecutedRoutedEventArgs e)
        {
            DirectoryPosition current = m_history.Redo(GetCurrentPosition());

            if (current != null)
            {
                SetCurrentPosition(current);
            }
        }
示例#3
0
        public void ChangePosition(DirectoryPosition new_pos)
        {
            var current = GetCurrentPosition();

            if (!current.Path.SequenceEqual(new_pos.Path))
            {
                SaveCurrentPosition();
            }
            SetCurrentPosition(new_pos);
        }