Example #1
0
        private void SendEmailNotificationOfNewCards(FlashDeck cardsAdded)
        {
            if (cardsAdded == null || cardsAdded.GetCards().Count() == 0)
            {
                return;
            }

            string emailSubject =
                string.Format("Les {0} dernières fiches qui étaient ajoutées " +
                              "à la petite application de Gerald",
                              cardsAdded.GetCards().Count());
            string emailStart = "Salut Dominic,\n\nC'est moi, le robot fait par Gerald pour vous " +
                                "informer de ses choses. Voila, les derniers développments:\n\n";
            string emailContent = "";
            string emailEnd     = "Merçi de votre attention,\nLe petit robot amical de Gerald";

            var cardListStringBuilder = new StringBuilder();

            foreach (Card card in cardsAdded.GetCards())
            {
                cardListStringBuilder.Append(card.ToString());
                cardListStringBuilder.Append("\n\n");
            }
            emailContent = cardListStringBuilder.ToString();
            string fullEmailBody = emailStart + emailContent + emailEnd;

            SendEmail(emailSubject, fullEmailBody);
        }
Example #2
0
 private void AddDefaultHistoryToActivateNewCards(FlashDeck cardsAdded)
 {
     foreach (Card cardAdded in cardsAdded?.GetCards())
     {
         _db.AddHistoryEntry(cardAdded, TrialPerformance.Fail);
     }
 }
Example #3
0
        private void BtnOpenFile_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog() == true)
            {
                FlashDeck cardsToAdd = FlashDeck.FromCSV(_cardServer, openFileDialog.FileName, GetSelectedFlashDeck(), _selectedDelimiter); // Make deck configurable
                _db.AddCardsToDeck(cardsToAdd.GetCards(), cardsToAdd.Name);
                AddDefaultHistoryToActivateNewCards(cardsToAdd);
                //SendEmailNotificationOfNewCards(cardsToAdd);
                FlashDeckViewModel.ReloadRequested = true;
            }
        }