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); } }
private void GoForwardExec(object sender, ExecutedRoutedEventArgs e) { DirectoryPosition current = m_history.Redo(GetCurrentPosition()); if (current != null) { SetCurrentPosition(current); } }
public void ChangePosition(DirectoryPosition new_pos) { var current = GetCurrentPosition(); if (!current.Path.SequenceEqual(new_pos.Path)) { SaveCurrentPosition(); } SetCurrentPosition(new_pos); }