Exemplo n.º 1
0
        protected bool cmdDelete_ButtonClick(object sender, EventArgs ev)
        {
            FileSystem fs = new FileSystem(Globals.CurrentIdentity);
            TreeNode destnode;
            string selstr;

            CFile.FileList selfiles = GetSelectedFiles();
            destnode = tvFiles.GetNodeFromIndex(tvFiles.SelectedNodeIndex);
            selstr = destnode.GetNodeIndex();

            if (selfiles.Count == 0) {
                DisplayMessage("No files selected to delete. Select files by checking the boxes to their left");
                return false;
            }

            try {
                fs.DeleteFiles(selfiles);
            }
            catch (FileOperationException e) {
                DisplayMessage("Error: " + e.Message);
                return false;
            }

            UpdateTreeNode(destnode, true);

            tvFiles.SelectedNodeIndex = selstr;
            BindFileGrid();
            return true;
        }