private void Content_Delete(object sender, ExecutedRoutedEventArgs e) { var file = this.FileTree.SelectedItem; var confirm = new ConfirmationWindow(file.Children == null ? "Delete file?" : "Delete folder?", $"Are you sure you want to delete '{file.Name}'? This cannot be undone.", cancelText: null) { Owner = this }; if (confirm.ShowDialog() == true) { Task.Run(() => this.PerformOperationAsync(file.DeleteAsync)); } }
private void Content_RemoveFolder(object sender, ExecutedRoutedEventArgs e) { var file = this.FileTree.SelectedItem; var confirm = new ConfirmationWindow("Remove folder?", $"Are you sure you want to move the contents of '{file.Name}' to the parent folder? This cannot be undone.", cancelText: null) { Owner = this }; if (confirm.ShowDialog() == true) { Task.Run(() => this.PerformOperationAsync(async() => { var dir = file.FullName.Substring(0, file.FullName.Length - file.Name.Length - 1); var children = file.Children.ToArray(); foreach (var c in children) { await c.RenameAsync(dir + c.Name); } await file.DeleteAsync(); })); } }