Ejemplo n.º 1
0
        private async Task ProcessNag(NagObject 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);
        }
Ejemplo n.º 2
0
        public async Task Register(NagObject nag, int launches)
        {
            if (nag == null)
            {
                throw new ArgumentNullException("nag");
            }

            var responseInfo = await Load(nag.Id, nag.Location);

            responseInfo.LaunchCount++;

            if (responseInfo.ShouldNag(launches))
            {
                await ProcessNag(nag, responseInfo);
            }
            else if (responseInfo.IsAwaitingResponse)
            {
                await PersistAsync(responseInfo, nag.Id, nag.Location);
            }
        }
Ejemplo n.º 3
0
        private async Task <NagResponse> ShowNag(NagObject nag)
        {
            MessageBoxResult result = MessageBoxResult.Cancel;

            if (nag.AllowDefer)
            {
                result = await _dialogService.PromptAsync(nag.Message, MessageBoxType.YesNoCancel, Settings.CustomResolver);
            }
            else
            {
                result = await _dialogService.PromptAsync(nag.Message, MessageBoxType.YesNo, Settings.CustomResolver);
            }
            switch (result)
            {
            case MessageBoxResult.Cancel: return(NagResponse.Defer);

            case MessageBoxResult.No: return(NagResponse.Decline);

            case MessageBoxResult.Yes: return(NagResponse.Accept);

            default: return(NagResponse.NoResponse);
            }
        }
Ejemplo n.º 4
0
 public async Task Register(NagObject nag, int launches, TimeSpan duration) => await _nagHelper.Register(nag, launches, duration);
Ejemplo n.º 5
0
 public async Task Register(NagObject nag, int launches) => await _nagHelper.Register(nag, launches);