private void DeleteSelectedItems() { String path = treeFolders.SelectedNode.FullPath; TreeNode thisNode = treeFolders.SelectedNode; Boolean deletedFolder = false; if (listFiles.SelectedItems.Count > 0) { foreach (ListViewItem item in listFiles.SelectedItems) { if (!item.Name.Equals(".") && !item.Name.Equals("..")) { Console.WriteLine(path + ", " + item.Name); if (myPhone.IsDirectory(path + "/" + item.Text)) { deletedFolder = true; } myPhone.DeleteFromDevice(path + "/" + item.Text); } } } if (deletedFolder) { FillTree(thisNode, path); } ShowFiles(thisNode, path); }
//Implements the search for listings by means of identification FindFirst and FindNext public override NT_STATUS ReadDirectory(UserContext UserContext, FileContext FileObject) { NT_STATUS error = NT_STATUS.OK; MyFileContext HE = (MyFileContext)FileObject; if (!HE.IsDirectory) { Debug.WriteLine("Warning->Handle is not a directory, can not get a listing"); return(NT_STATUS.INVALID_HANDLE); } if (!phone.Exists(root + HE.Name) || !phone.IsDirectory(root + HE.Name)) { return(NT_STATUS.OBJECT_PATH_NOT_FOUND); // Directroy not found, should never happen } HE.Items.Add(new DirectoryContext(".", FileAttributes.Directory)); HE.Items.Add(new DirectoryContext("..", FileAttributes.Directory)); DirectoryContext Item = null; foreach (string DirName in phone.GetDirectories(root + HE.Name)) { error = GetAttributes(UserContext, root + HE.Name + DirName, out Item); if (error != 0) { Trace.WriteLine("Warning->Error: '" + error + "' during listing directories: " + HE.Name + DirName); } HE.Items.Add(Item); } foreach (string FileName in phone.GetFiles(root + HE.Name)) { error = GetAttributes(UserContext, root + HE.Name + FileName, out Item); if (error != 0) { Trace.WriteLine("Warning->Error: '" + error + "' during listing files: " + FileName); } else { HE.Items.Add(Item); } } return(NT_STATUS.OK); }