private async void HDFSFileGridView_SelectionChanged(object sender, Telerik.UI.Xaml.Controls.Grid.DataGridSelectionChangedEventArgs e) { if (e.AddedItems.Count() == 0) { return; } var list = new List <ServerLocatedBlocks>(); var item = e.AddedItems.First() as PresentData; var fileItem = item.OriginFile; if ((await fileItem.Status).type == "FILE") { BlockList = (await fileItem.GetBlocksAsync()).locatedBlocks; foreach (var block in BlockList) { foreach (var location in block.locations) { var serverIndex = list.FindIndex(p => p.HostName == location.hostName); if (serverIndex == -1) { list.Add(new ServerLocatedBlocks { HostName = location.hostName, LocatedBlockList = new List <LocatedBlock>() { block } }); } else { list[serverIndex].LocatedBlockList.Add(block); } } } LocatedBlockList = list; } else { CurrentFolder = fileItem; FileList = await fileItem.SubFile; var pList = new List <PresentData>(); foreach (var file in FileList) { var presentFile = new PresentData(); await presentFile.InitAsync(file); pList.Add(presentFile); } PresentList = pList; } }
public async void GetRootFolderAsync() { CurrentFolder = new HDFSFile() { ServerHost = CurrentServer.MasterNode.Host, Path = "" }; FileList = await CurrentFolder.SubFile; var pList = new List <PresentData>(); foreach (var file in FileList) { var presentFile = new PresentData(); await presentFile.InitAsync(file); pList.Add(presentFile); } PresentList = pList; }
private async Task UpdateFolderFromAddressAsync() { var Folder = new HDFSFile() { ServerHost = CurrentServer.MasterNode.Host, Path = FolderPathTextBox.Text }; if (await Folder.SubFile != null) { FileList = await Folder.SubFile; var pList = new List <PresentData>(); foreach (var file in FileList) { var presentFile = new PresentData(); await presentFile.InitAsync(file); pList.Add(presentFile); } PresentList = pList; } }