Esempio n. 1
0
        private async Task <bool> LoadFolderNodeIfNull()
        {
            if (_foldrNode != null)
            {
                return(true);
            }

            _foldrNode = await _client.Node <SyncableFolderDto>(_foldrNid, _cancelToken);

            // set the flag to disable downloads
            _foldrNode.field_currently_updating.und.Clear();
            _foldrNode.field_currently_updating.und.Add(und.Value(1));

            _foldrNode = await _client.Put(_foldrNode, _cancelToken);

            if (_foldrNode.IsValidNode())
            {
                return(Debug_n("Flag set to temporarily disable downloads.", ""));
            }
            else
            {
                return(Warn_n("Something went wrong in updating App node.", ""));
            }
        }
Esempio n. 2
0
        private async Task <bool> UpdateItem(TClass item, CancellationToken tkn)
        {
            Throw.IfNull(item, "node to update");
            Throw.IfNull(_client, "‹ID7Client›_client instance");

            ID7NodeRevision dto;

            try { dto = D7FieldMapper.Map(item).As <ID7NodeRevision>(); }
            catch (Exception ex)
            { return(LogError("D7FieldMapper.Map(item)", ex)); }

            if (dto == null)
            {
                return(false);
            }
            dto.nid = item.nid;
            dto.vid = item.As <ID7NodeRevision>().vid;
            if (!await _client.Put(dto, tkn))
            {
                return(false);
            }
            RaiseOneChangeCommitted();
            return(true);
        }