예제 #1
0
        private async void RemoveItem(object obj)
        {
            if (await FocusedNode.RemoveAsync(false) != NodeActionResult.Cancelled)
            {
                String parentNodePath = ((new DirectoryInfo(FocusedNode.NodePath)).Parent).FullName;

                String sfoRootPath = Path.Combine(ApplicationData.Current.LocalFolder.Path,
                                                  AppResources.DownloadsDirectory.Replace("\\", ""));

                // Check if the previous folders of the path are empty and
                // remove from the offline and the DB on this case
                while (String.Compare(parentNodePath, sfoRootPath) != 0)
                {
                    var folderPathToRemove = parentNodePath;
                    parentNodePath = ((new DirectoryInfo(parentNodePath)).Parent).FullName;

                    if (FolderService.IsEmptyFolder(folderPathToRemove))
                    {
                        Deployment.Current.Dispatcher.BeginInvoke(() => GoFolderUp());
                        FolderService.DeleteFolder(folderPathToRemove);
                        SavedForOffline.DeleteNodeByLocalPath(folderPathToRemove);
                    }
                }

                Refresh();
            }
        }
예제 #2
0
 private async void RemoveItem(object obj)
 {
     if (FocusedNode != null)
     {
         await FocusedNode.RemoveAsync(false);
     }
 }