예제 #1
0
        public async Task PersistAsync(NagResponseInfo state, string nagId, NagStorageStrategies location)
        {
            // TODO: use location

            if (state == null)
            {
                throw new ArgumentNullException("state");
            }
            if (string.IsNullOrEmpty(nagId))
            {
                throw new ArgumentException("nagId cannot be null or empty", "nagId");
            }

            await _fileService.WriteFileAsync <NagResponseInfo>(GetFileName(nagId), state);
        }
예제 #2
0
        private async Task ProcessNag(NagEx nag, NagResponseInfo responseInfo)
        {
            var response = await ShowNag(nag);

            if (response == NagResponse.Accept)
            {
                nag.NagAction();
            }
            else if (response == NagResponse.Defer)
            {
                responseInfo.LaunchCount           = 0;
                responseInfo.RegistrationTimeStamp = DateTimeOffset.UtcNow;
            }

            responseInfo.LastResponse = response;
            responseInfo.LastNag      = DateTimeOffset.UtcNow;

            await PersistAsync(responseInfo, nag.Id, nag.Location);
        }