コード例 #1
0
        private FolderTreeItemViewModel(DirectoryInfo dirInfo, FolderTreeItemViewModel parent,
                                        IEventAggregator eventAggregator)
        {
            if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
            {
                return;
            }

            _absolutePath = dirInfo.FullName;
            _parent       = parent;

            _eventAggregator = eventAggregator;

            _children = new ObservableCollection <IFolderTreeItemViewModel>(
                (from child in dirInfo.GetDirectories()
                 select new FolderTreeItemViewModel(child, parent: this, eventAggregator: eventAggregator)).ToList());

            NotifyPropertyChanged(() => Children);
            NotifyPropertyChanged(() => ViewTitle);

            OpenPicturesInFolderCommand = new RelayCommand <object>(OnOpenPicturesInFolder);
            DropCommand = new RelayCommand <object>(OnDropCommand);
        }
コード例 #2
0
        public bool IsAParentTo(FolderTreeItemViewModel treeItem)
        {
            var parent = new DirectoryInfo(AbsolutePath).Parent;

            return(parent.FullName == treeItem.AbsolutePath);
        }