Ejemplo n.º 1
0
        public async Task <IEnumerable <bool> > PullLatest(string KindId, string Kind)
        {
            await InitializeStore().ConfigureAwait(false);
            await PullLatestAsync().ConfigureAwait(false);

            var items = await GetItemsByKindAndReferenceIdAsync(KindId, Kind);

            List <bool> returnBool = new List <bool>();

            if (items != null)
            {
                foreach (var item in items)
                {
                    var fileName = item.InternalName + "." + item.Extension;
                    var IsExist  = await PclStorage.IsFileExistAsync(fileName, item.ReferenceKind, item.ReferenceId);

                    if (!IsExist && !string.IsNullOrEmpty(item.Path)) // Only download files who have some value in the path field.
                    {
                        var document = await DownLoadDocument(item.Id);

                        if (document != null)
                        {
                            var response = await PclStorage.SaveFileLocal(document, fileName, item.ReferenceKind, item.ReferenceId);

                            if (response == true)
                            {
                                returnBool.Add(true);
                            }
                            else
                            {
                                returnBool.Add(false);
                            }
                        }
                        else
                        {
                            returnBool.Add(false);
                        }
                    }
                    else
                    {
                        returnBool.Add(true);
                    }
                }
            }

            return(returnBool);
        }
Ejemplo n.º 2
0
        private async Task PullLatest()
        {
            await InitializeStore().ConfigureAwait(false);

            var items = await GetItemsAsync(true);

            foreach (var item in items)
            {
                var IsExist = await PclStorage.IsFileExistAsync(item.Id);

                if (!IsExist)
                {
                    var document = await DownLoadDocument(item.Id);

                    if (document != null)
                    {
                        var response = await PclStorage.SaveFileLocal(document, item.Id);
                    }
                }
            }
        }