Exemplo n.º 1
0
 private void AddDefaultHistoryToActivateNewCards(FlashDeck cardsAdded)
 {
     foreach (Card cardAdded in cardsAdded?.GetCards())
     {
         _db.AddHistoryEntry(cardAdded, TrialPerformance.Fail);
     }
 }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public FlashDeck GetDeck(CardServer cardServer, string deckName)
        {
            FlashDeck    deck  = FlashDeck.FromNothing(cardServer, deckName);
            IList <Card> cards = getCardsForDeck(deckName);

            deck.AddCards(cards);
            return(deck);
        }
Exemplo n.º 4
0
        public FlashDeck GetCompoundDeck(CardServer cardServer, string[] deckNames)
        {
            FlashDeck deck = FlashDeck.FromNothing(cardServer, GetCompoundDeckName(deckNames));

            foreach (var deckName in deckNames)
            {
                IList <Card> cards = getCardsForDeck(deckName);
                deck.AddCards(cards);
            }
            return(deck);
        }
Exemplo n.º 5
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;
            }
        }