/// <summary> /// Method show new state of ListView after item's selection /// </summary> /// <param name="listView"></param> /// <param name="button"></param> private void PushSelected(ListView listView, Button button) { try { if (listView.SelectedItem is DriveTree) { button.Content = DirectoryTree.GetParentDirectory(((DriveTree)listView.SelectedItem).Name); DirectoryTree.GetIntoDirectory(((DriveTree)listView.SelectedItem).Name, listView); } else if (listView.SelectedItem is DirectoryInTree) { button.Content = DirectoryTree.GetParentDirectory( ((DirectoryInTree)listView.SelectedItem).FullPath); DirectoryTree.GetIntoDirectory(((DirectoryInTree)listView.SelectedItem).FullPath, listView); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Method handles behavior of applecation if button BACK is pushed in ListViewDestinationTo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonBackUpTo_OnClick(object sender, RoutedEventArgs e) { try { if (!string.IsNullOrEmpty(ButtonBackUpTo.Content.ToString())) { DirectoryTree.GetIntoDirectory(ButtonBackUpTo.Content.ToString(), ListViewDestinationTo); ButtonBackUpTo.Content = string.Format(DirectoryTree.GetParentDirectory(ButtonBackUpTo.Content.ToString())); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }