private async void setArchivos() { this.archivos.Clear(); try { StorageFolder localFolder = await Utils.BaseFolder.GetFolderAsync(this.carpeta.Name.Replace("Page", string.Empty)); IReadOnlyList <StorageFolder> destinationFolders = await localFolder.GetFoldersAsync(); foreach (StorageFolder folder in destinationFolders) { try { StorageFile file = await folder.GetFileAsync("Metadata.dat"); IList <string> lines = await FileIO.ReadLinesAsync(file); JsonObject jsonObject = JsonObject.Parse(lines.First()); JsonArray jsonArray = jsonObject.GetNamedArray("Etiquetas"); List <Models.Etiquetas.Etiquetas> lst = new List <Models.Etiquetas.Etiquetas>(); foreach (IJsonValue fila in jsonArray) { Models.Etiquetas.Etiquetas tag = new Models.Etiquetas.Etiquetas(fila); lst.Add(tag); } TransferirModel c = new TransferirModel() { Nombre = folder.Name, Alias = String.Join("-", lst.Select(p => p.Valor)), Enviando = false, Mensaje = null }; this.archivos.Add(c); } catch (Exception) { // No pasa nada } } } catch (Exception) { // No pasa nada } finally { OnPropertyChanged("IsSeleccionarAllowed"); } }
public async Task <Models.Archivos.Archivos_PostBindingModel> getModel(string Carpeta) { Models.Archivos.Archivos_PostBindingModel model = new Models.Archivos.Archivos_PostBindingModel(); try { StorageFolder localFolder = await Utils.BaseFolder.GetFolderAsync(this.carpeta.Name.Replace("Page", string.Empty)); StorageFolder folder = await localFolder.GetFolderAsync(Carpeta); StorageFile metadata = await folder.GetFileAsync("Metadata.dat"); IList <string> lines = await FileIO.ReadLinesAsync(metadata); JsonObject jsonObject = JsonObject.Parse(lines.First()); model.Aplicacion = jsonObject.GetNamedString("Aplicacion"); model.Categoria = Convert.ToInt16(jsonObject.GetNamedNumber("Categoria")); List <Models.Etiquetas.Etiquetas> lst = new List <Models.Etiquetas.Etiquetas>(); JsonArray jsonArray = jsonObject.GetNamedArray("Etiquetas"); foreach (IJsonValue jsonValue in jsonArray) { Models.Etiquetas.Etiquetas tag = new Models.Etiquetas.Etiquetas(jsonValue); lst.Add(tag); } model.Etiquetas = lst; } catch (Exception) { throw; } return(model); }