private async Task LoadFilesAsync() { OpenDocuments.Clear(); var tokens = await Settings.GetFileTokensAsync(); var documents = new List <BaseDocumentViewModel>(); foreach (string token in tokens) { try { StorageFile file; bool isSaveable = false; if (token.StartsWith("SampleFile:")) { string fileName = token.Substring("SampleFile:".Length); file = await StorageFile.GetFileFromApplicationUriAsync(new Uri($"ms-appx:///{SamplesFolderName}/{fileName}")); } else { file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync(token); isSaveable = true; } if (file != null) { documents.Add(await LoadFromFileAsync(file, token, Properties, isSaveable)); } } catch { } } try { var samplesFolder = await Package.Current.InstalledLocation.GetFolderAsync(SamplesFolderName); foreach (var file in await samplesFolder.GetFilesAsync()) { if (file.FileType.ToLower().Equals(".json")) { AddDocumentItems.Add(new AddDocumentListItem() { DisplayName = file.Name, File = file }); } } } catch { } foreach (var doc in documents) { AddDocument(doc); } var currDoc = documents.FirstOrDefault(i => i.Token == _currentDocumentToken.Value); if (currDoc == null) { currDoc = documents.FirstOrDefault(); } CurrentDocument = currDoc; }