Пример #1
0
        private void ListBox_Drop(object sender, DragEventArgs e)
        {
            var data = (DirectoryItem)(e.Data.GetData(typeof(DirectoryItem)));

            if (!DirectoryStructure.MoveDirectoryItem(data, viewModel.SelectedItem.FullPath))
            {
                MessageBox.Show("Неможливо виконати дане переміщення.");
            }
            UpdateViewModelManager.UpdateFileExplorerViewModels();
        }
Пример #2
0
        public DirectoryStructureViewModel()
        {
            var drives = DirectoryStructure.GetLogicalDrives();

            Items = new ObservableCollection <DirectoryItemViewModel>(
                drives.Select(
                    child => new DirectoryItemViewModel(
                        child.FullPath,
                        DirectoryItemType.Drive)));
        }
 /// <summary>
 /// Default constructor.
 /// </summary>
 public DirectoryStructureViewModel()
 {
     Items = new ObservableCollection <DirectoryItemViewModel>
             (
         DirectoryStructure.GetLogicalDrives().Select
         (
             item => new DirectoryItemViewModel(item.FullPath, item.Type)
         )
             );
 }
        public void Update()
        {
            var expanedItems = GetExpandedItems(Items.ToList());

            Items = new ObservableCollection <DirectoryItemViewModel>
                    (
                DirectoryStructure.GetLogicalDrives().Select
                (
                    item => new DirectoryItemViewModel(item.FullPath, item.Type)
                )
                    );

            ExpandItems(expanedItems);
        }
Пример #5
0
        /// <summary>
        /// Expands this directory and finds all children
        /// </summary>
        private void Expand()
        {
            if (Type == DirectoryItemType.File)
            {
                return;
            }

            var children = DirectoryStructure.GetDirectoryContents(FullPath);

            Children = new ObservableCollection <DirectoryItemViewModel>
                       (
                children.Select(item => new DirectoryItemViewModel(item.FullPath, item.Type))
                       );
        }