public async Task <ObservableCollection <ReplicationDataItem> > FetchDocumentsAsync()
        {
            var documents = new ObservableCollection <ReplicationDataItem>();

            // Fetch documents from the database
            for (int i = 0; i < _rowCount; i++)
            {
                var result = await _database.FetchDocument(i.ToString());

                var documentData   = JsonConvert.SerializeObject(result.ToDictionary());
                var attachmentData = result.Attachments[0].Data;

                FruitDocument   document   = JsonConvert.DeserializeObject <FruitDocument>(documentData);
                FruitAttachment attachment = new FruitAttachment()
                {
                    imageData = attachmentData.ToArray()
                };

                documents.Add(new ReplicationDataItem()
                {
                    Document = document, Attachment = attachment
                });
            }

            // Ensure each document is fetched before returning the documents
            return(documents);
        }
Пример #2
0
 public ResultDetailViewModel(FruitDocument doc, FruitAttachment attachment)
 {
     _doc        = doc;
     _attachment = attachment;
 }