Пример #1
0
        private bool DeleteFolder(FileTreeModel treenode, ServiceInfo client)
        {
            try
            {
                DirectoryNode parentnode = treenode.Node as DirectoryNode;

                foreach (var child in treenode.Children)
                {
                    var node = (child.Node as DirectoryNode);
                    if (child.IsChecked)
                    {
                        if (node.IsFile)
                        {
                            client.FileAction(node.Path, true);
                        }
                        else
                        {
                            DeleteFolder(child, client);
                        }
                    }

                }
                if (client.FolderEmpty(parentnode.Path))
                    client.FolderAction(parentnode.Path, true);

            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return false;
            }
            return true;
        }