Пример #1
0
        public DirectoryBrowser()
        {
            InitializeComponent();

            VisualStyleUtil.StyleTreeView(_treeView);

            _imageList.Assign(_treeView);

            _watcher.IncludeSubdirectories = true;
            _watcher.NotifyFilter          = NotifyFilters.CreationTime | NotifyFilters.DirectoryName | NotifyFilters.LastWrite;
            _watcher.SynchronizingObject   = this;
            _watcher.Changed += _watcher_Changed;
            _watcher.Created += _watcher_Changed;
            _watcher.Deleted += _watcher_Changed;
            _watcher.Renamed += _watcher_Renamed;

            _treeView.Nodes.Add(new TreeNode("Root"));

            var dragDropManager = new DragDropManager(this);

            dragDropManager.DragEnter += _dragDropManager_DragEnter;
            dragDropManager.DragLeave += _dragDropManager_DragLeave;
            dragDropManager.DragOver  += _dragDropManager_DragOver;
            dragDropManager.DragDrop  += _dragDropManager_DragDrop;

            Reload();
        }
Пример #2
0
        public FileBrowser()
        {
            InitializeComponent();

            Enabled = false;

            VisualStyleUtil.StyleListView(_listView);

            _imageList.Assign(_listView);

            _watcher.IncludeSubdirectories = false;
            _watcher.NotifyFilter          = NotifyFilters.Attributes | NotifyFilters.CreationTime | NotifyFilters.FileName | NotifyFilters.LastWrite;
            _watcher.SynchronizingObject   = this;
            _watcher.Changed += _watcher_Changed;
            _watcher.Created += _watcher_Changed;
            _watcher.Deleted += _watcher_Changed;
            _watcher.Renamed += _watcher_Changed;

            var dragDropManager = new DragDropManager(this);

            dragDropManager.DragEnter += _dragDropManager_DragEnter;
            dragDropManager.DragDrop  += _dragDropManager_DragDrop;

            Reload();
        }