예제 #1
0
 public async Task AddTriviaMessageToDatabase(TriviaMessageDto response)
 {
     using (var databaseContext = new DatabaseContext())
     {
         var triviaMessage = new TriviaMessage
         {
             Sender      = response.Sender,
             MessageText = response.MessageText,
             Timestamp   = DateTime.Now,
         };
         databaseContext.TriviaMessages.Add(triviaMessage);
         CleanDatabase(databaseContext);
         await databaseContext.SaveChangesAsync();
     }
 }
예제 #2
0
        private async Task HandleOpenSolutionAsync(object sender = null, EventArgs e = null)
        {
            var GeneralOptionsDto = await GetGeneralOptionsDtoAsync();

            var shouldShowTrivia = new DecisionMaker().ShouldShowTrivia(GeneralOptionsDto);

            if (shouldShowTrivia)
            {
                await JoinableTaskFactory.SwitchToMainThreadAsync();

                var popUpTitle       = CommonConstants.GetCaption(Vsix.Name, Vsix.Version);
                var hiddenOptionsDto = new TriviaMessage().ShowTrivia(AppName.NumericTrivia, popUpTitle, GeneralOptionsDto.LastPopUpDateTime, GeneralOptionsDto.PopUpCountToday, GeneralOptionsDto.TimeOutInMilliSeconds, Vsix.Name);

                if (hiddenOptionsDto != null)
                {
                    UpdateHiddenOptions(hiddenOptionsDto);
                }

                //ChaseRating();
            }
        }