Ejemplo n.º 1
0
        private void View_DeleteDirectory(object sender, DirectoryEventArgs e)
        {
            if (!_dialogView.ConfirmDelete(e.FullPath))
            {
                return;
            }

            try
            {
                _fileSystem.DeleteDirectory(e.FullPath, true);
                View.RemoveDirectory(PathUtils.Split(e.FullPath));
            }
            catch (DirectoryNotFoundException)
            {
                _dialogView.DirectoryNotFound(e.FullPath);
                // we stil want to remove the directory from the view
                View.RemoveDirectory(PathUtils.Split(e.FullPath));
            }
            catch (UnauthorizedAccessException)
            {
                _dialogView.UnauthorizedAccess(e.FullPath);
            }
            catch (IOException)
            {
                _dialogView.FileInUse(e.FullPath);
            }
        }
Ejemplo n.º 2
0
        private void View_OpenInExplorer(object sender, DirectoryEventArgs e)
        {
            var fullPath = Path.GetFullPath(e.FullPath);

            Process.Start(
                Resources.ExplorerProcessName,
                string.Format(Resources.ExplorerOpenFolderArguments, fullPath)
                );
        }
Ejemplo n.º 3
0
 private void View_CopyDirectory(object sender, DirectoryEventArgs e)
 {
     try
     {
         _clipboard.SetFiles(new ClipboardFileDrop(new[] { e.FullPath }, DragDropEffects.Copy));
     }
     catch (ExternalException ex)
     {
         _dialogView.ClipboardIsBusy(ex.Message);
     }
 }
Ejemplo n.º 4
0
 private void View_PasteClipboardToDirectory(object sender, DirectoryEventArgs e)
 {
     try
     {
         var files = _clipboard.GetFiles();
         PasteFiles(e.FullPath, files, files.Effect);
     }
     catch (ExternalException ex)
     {
         _dialogView.ClipboardIsBusy(ex.Message);
     }
 }
Ejemplo n.º 5
0
        private async void View_ExpandDirectory(object sender, DirectoryEventArgs e)
        {
            var directories = await Task.Run(() => GetValidSubdirectories(e.FullPath));

            if (_isDisposed)
            {
                return;
            }

            var pathParts = PathUtils.Split(e.FullPath);

            View.LoadDirectories(pathParts, directories, false);
        }
Ejemplo n.º 6
0
 private void View_CreateDirectory(object sender, DirectoryEventArgs e)
 {
     try
     {
         var newName       = "New Folder";
         var directoryPath = Path.Combine(e.FullPath, newName);
         _fileSystem.CreateDirectory(directoryPath);
         View.AddDirectory(PathUtils.Split(e.FullPath), new DirectoryView
         {
             UserName = newName,
             FileName = newName
         });
         View.BeginEditDirectory(PathUtils.Split(directoryPath));
     }
     catch (UnauthorizedAccessException)
     {
         _dialogView.UnauthorizedAccess(e.FullPath);
     }
     catch (DirectoryNotFoundException)
     {
         _dialogView.DirectoryNotFound(e.FullPath);
     }
 }
Ejemplo n.º 7
0
 private void View_OpenDirectory(object sender, DirectoryEventArgs e)
 {
     _state.ExecuteQuery(_queryFactory.CreateQuery(e.FullPath));
 }