Exemple #1
0
        private async Task ZipAsync()
        {
            var zipPath = Path.Combine(
                Navigation.FullPath,
                Path.ChangeExtension(SelectedPaths.First(), ".zip")
                ).CopyableFileName();

            using (var archive = ZipFile.Open(zipPath, ZipArchiveMode.Create))
            {
                var operations = SelectedPaths.Select(path => ZipOperation(archive, path)).ToArray();

                var dialog = new OperationProgressViewModel(operations)
                {
                    Caption = string.Format(Properties.Resources.File_Zipping, operations.Sum(o => o.Count))
                };

                await Messenger.SendAsync(dialog);
            }
        }
Exemple #2
0
        private async Task DeleteFilesAsync(bool moveToRecycleBin = true)
        {
            var operations = SelectedPaths.Select(path => DeleteOperation(path, moveToRecycleBin)).ToArray();

            var selectionText = Host.ActiveFileManager.SelectionText;
            var messageBox    = new MessageBoxViewModel
            {
                Button  = MessageBoxButton.YesNo,
                Icon    = MessageBoxImage.Question,
                Caption = Properties.Resources.MessageBox_Confirm,
                Text    = string.Format(moveToRecycleBin ? Properties.Resources.File_Recycling : Properties.Resources.File_Deleting, selectionText)
            };
            await Messenger.SendAsync(messageBox);

            if (messageBox.Result != MessageBoxResult.Yes)
            {
                return;
            }

            await Messenger.SendAsync(new OperationProgressViewModel(operations)
            {
                Caption = string.Format(Properties.Resources.File_DeletingProgress, operations.Sum(o => o.Count))
            });
        }