Example #1
0
        public OpenFolderAction(string path, IFileExplorer fileExplorer)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException(nameof(path));
            }

            if (fileExplorer == null)
            {
                throw new ArgumentNullException(nameof(fileExplorer));
            }

            _fileExplorer = fileExplorer;

            _task = Task.Run(() =>
            {
                if (!FileEx.Exists(path, TimeSpan.FromSeconds(1)))
                {
                    FullFoldername = FileEx.FindClosestExistingFolder(path);
                    _fileExplorer.OpenFolder(FullFoldername);
                }
                else
                {
                    FullFoldername = path;
                    _fileExplorer.SelectFile(path);
                }
            })
                    .ContinueWith(OnFolderOpened);
        }
Example #2
0
        public OpenFolderAction(string[] files, string folder, IFileExplorer fileExplorer)
        {
            if (files == null)
            {
                throw new ArgumentNullException(nameof(files));
            }

            if (string.IsNullOrEmpty(folder))
            {
                throw new ArgumentNullException(nameof(folder));
            }

            if (fileExplorer == null)
            {
                throw new ArgumentNullException(nameof(fileExplorer));
            }

            _fileExplorer = fileExplorer;

            _task = Task.Run(() =>
            {
                if (!Directory.Exists(folder))
                {
                    FullFoldername = FileEx.FindClosestExistingFolder(folder);
                    _fileExplorer.OpenFolder(FullFoldername);
                }
                else
                {
                    FullFoldername = folder;
                    _fileExplorer.SelectFiles(FullFoldername, files);
                }
            })
                    .ContinueWith(OnFolderOpened);
        }
 protected override void Open(string path)
 {
     _fileExplorer.OpenFolder(path);
 }