Exemplo n.º 1
0
        private async Task <bool> IsStale(VocabIdentifier vocabID, TimeSpan maxAge)
        {
            DateTimeOffset dt = await m_root.Store.GetUpdateDateAsync(vocabID.GetKey());

            TimeSpan offset = DateTimeOffset.Now.Subtract(dt);

            return(offset >= maxAge);
        }
Exemplo n.º 2
0
        public IAsyncAction RemoveAsync(VocabIdentifier vocabID)
        {
            if (vocabID == null)
            {
                throw new ArgumentNullException("vocabID");
            }

            return(m_root.Store.DeleteAsync(vocabID.GetKey()).AsAsyncAction());
        }
Exemplo n.º 3
0
        public IAsyncAction PutAsync(VocabIdentifier vocabID, VocabCodeSet vocab)
        {
            if (vocabID == null)
            {
                throw new ArgumentNullException("vocabID");
            }
            if (vocab == null)
            {
                throw new ArgumentNullException("vocab");
            }
            string key = vocabID.GetKey();

            return(m_root.Store.PutAsync(key, vocab).AsAsyncAction());
        }
Exemplo n.º 4
0
        private async Task <VocabCodeSet> GetVocabAsync(VocabIdentifier vocabID)
        {
            string key = vocabID.GetKey();

            return((VocabCodeSet)await m_root.Store.GetAsync(key, typeof(VocabCodeSet)));
        }