private void TreeView_Selected(object sender, RoutedEventArgs e)
        {
            var tvi = e.OriginalSource as TreeViewItem;

            if (tvi != null)
            {
                SelectedItem = tvi.DataContext as TreeItem;
                SelectedPath = SelectedItem.GetFullPath();
            }
        }
Exemplo n.º 2
0
 private void CheckSelected()
 {
     if (!SelectedItem.Forbidden && !SelectedItem.IsFullyLoaded)
     {
         try
         {
             new DirectoryInfo(SelectedItem.GetFullPath()).GetDirectories();
         }
         catch (UnauthorizedAccessException ex)
         {
             SelectedItem.Forbidden = true;
         }
     }
     if (SelectedItem.Forbidden)
     {
         SelectedPath = null;
     }
     else
     {
         SelectedPath = SelectedItem.GetFullPath();
     }
 }