private void DisplayPopUpMessage(TriviaDialogDto triviaDialogDto)
        {
            var triviaDialog = new TriviaDialog(triviaDialogDto.AppName, triviaDialogDto.OptionsName)
            {
                AppTextBlockAnswer       = { Text = triviaDialogDto.Answer },
                AppTextBlockAttribution  = { Text = triviaDialogDto.Attribution },
                AppTextBlockErrorDetails = { Text = triviaDialogDto.ErrorDetails },
                AppTextBlockFact         = { Text = triviaDialogDto.Fact },
                AppTextBlockQuestion     = { Text = triviaDialogDto.Question },
                AppTextBlockQuotation    = { Text = triviaDialogDto.Quotation },
                Title = triviaDialogDto.PopUpTitle,
            };

            var iconUri = GetIconUri(triviaDialogDto.AppName);

            triviaDialog.AppImage.Source = new BitmapImage(iconUri);

            if (!string.IsNullOrEmpty(triviaDialogDto.HyperLinkUri))
            {
                triviaDialog.AppHyperlink1.NavigateUri = new Uri(triviaDialogDto.HyperLinkUri);
                triviaDialog.AppHyperlink1.Inlines.Clear();
                triviaDialog.AppHyperlink1.Inlines.Add(triviaDialogDto.HyperLinkUri);
            }

            if (!string.IsNullOrWhiteSpace(triviaDialog.AppTextBlockErrorDetails.Text))
            {
                triviaDialog.AppTextBlockErrorDetails.Visibility = Visibility.Visible;
            }

            if (!string.IsNullOrWhiteSpace(triviaDialog.AppTextBlockFact.Text))
            {
                triviaDialog.AppTextBlockFact.Visibility = Visibility.Visible;
            }

            if (!string.IsNullOrWhiteSpace(triviaDialog.AppTextBlockQuestion.Text))
            {
                triviaDialog.AppTextBlockQuestion.Visibility = Visibility.Visible;
            }

            if (!string.IsNullOrWhiteSpace(triviaDialog.AppTextBlockQuotation.Text))
            {
                triviaDialog.AppTextBlockQuotation.Visibility = Visibility.Visible;
            }

            if (!string.IsNullOrWhiteSpace(triviaDialog.AppTextBlockAttribution.Text))
            {
                triviaDialog.AppTextBlockAttribution.Visibility = Visibility.Visible;
                triviaDialog.AppTextBlockHyperLink.Visibility   = Visibility.Visible;
            }

            if (!string.IsNullOrWhiteSpace(triviaDialog.AppTextBlockAnswer.Text))
            {
                triviaDialog.AppBtnRevealAnswer.Visibility = Visibility.Visible;
            }

            triviaDialog.Show();
        }
        public HiddenOptionsDto ShowTrivia(AppName appName, string popUpTitle, DateTime lastPopUpDateTime, int popUpCountToday, int timeOutInMilliSeconds, string optionsName)
        {
            HiddenOptionsDto hiddenOptionsDto = null;

            var clientGateway   = new ClientGateway();
            var gatewayResponse = clientGateway.GetGatewayResponse(appName, timeOutInMilliSeconds, CommonConstants.TimeOutInMilliSecondsOptionLabel, optionsName);

            var somethingToShow = false;
            var triviaDialogDto = new TriviaDialogDto
            {
                AppName     = appName,
                OptionsName = optionsName,
                PopUpTitle  = popUpTitle
            };

            if (!string.IsNullOrEmpty(gatewayResponse.ErrorDetails))
            {
                triviaDialogDto.ErrorDetails = gatewayResponse.ErrorDetails;
                somethingToShow = !string.IsNullOrEmpty(triviaDialogDto.ErrorDetails);
            }
            else
            {
                switch (appName)
                {
                case AppName.Jeopardy:
                    var gatewayResponseJeopardy = (GatewayResponseJeopardy)gatewayResponse;
                    triviaDialogDto.Answer   = "A. " + gatewayResponseJeopardy.Answer;
                    triviaDialogDto.Question = "Q. " + gatewayResponseJeopardy.Question;
                    somethingToShow          = !string.IsNullOrEmpty(triviaDialogDto.Question);
                    break;

                case AppName.NumericTrivia:
                    var gatewayResponseNumeric = (GatewayResponseNumericTrivia)gatewayResponse;
                    triviaDialogDto.Fact = gatewayResponseNumeric.NumericFact;
                    somethingToShow      = !string.IsNullOrEmpty(triviaDialogDto.Fact);
                    break;

                case AppName.TrumpQuotes:
                    var gatewayResponseTrump = (GatewayResponseTrumpQuotes)gatewayResponse;
                    triviaDialogDto.HyperLinkUri = gatewayResponseTrump.HyperLinkUri;
                    triviaDialogDto.Quotation    = gatewayResponseTrump.TrumpQuote;
                    triviaDialogDto.Attribution  = gatewayResponseTrump.QuotationAuthor + spacer + gatewayResponseTrump.QuotationDate + spacer;
                    somethingToShow = !string.IsNullOrEmpty(triviaDialogDto.Quotation);
                    break;
                }
            }

            if (somethingToShow)
            {
                DisplayPopUpMessage(triviaDialogDto);
                hiddenOptionsDto = GetHiddenOptionsDto(lastPopUpDateTime, popUpCountToday);
            }

            return(hiddenOptionsDto);
        }