public void AsFlashcards() { if (TryLoadQuestions()) { var cards = new List <Card>(); foreach (Question q in questions) { Card card = q.AsCard(); if (Properties.Settings.Default.testSort == (int)SortType.REVERSE) { card.Swap(); } cards.Add(card); } if (Properties.Settings.Default.testSort == (int)SortType.REVERSE) { cards.Shuffle(); } Flashcards.StartFlashcards(name, cards.ToArray()); } }
static Flashcards[] GetQuestions(int size, bool division = false) { Flashcards[] questionSet = new Flashcards[size]; if (division == true) // Division questions will not contain 0s. { for (int i = 0; i < size; i++) { questionSet[i] = new Flashcards { num1 = r.Next(1, 13), num2 = r.Next(1, 13) }; } } else { for (int i = 0; i < size; i++) { questionSet[i] = new Flashcards { num1 = r.Next(13), num2 = r.Next(13) }; } } return(questionSet); }
public override void Edit() { GetForm.BeginEditing($"{Dir}{PanelName}"); Flashcards.Edit(PanelName, Dir, (n, d) => { GetForm.StopEditing($"{Dir}{PanelName}"); }); }
public override void NextFlashcard() { Flashcards.RemoveAt(0); if (Flashcards.Count == 0) { IsOver = true; } }
public override void Duplicate() { GetForm.BeginEditing(Dir); GetForm.SetNativeEnabled(false); Flashcards.Duplicate(PanelName, Dir, () => GetForm.SetNativeEnabled(true), (n, d) => { GetForm.StopEditing(Dir); if (n != "" && d == Dir) { GetForm.AddPanel(new FlashcardsPanel(owner, n, Dir), true); } }); }
private void AddFlashcardsBtn_Click(object sender, EventArgs e) { SetNativeEnabled(false); BeginEditing(GetFullDir); Flashcards.Create(GetFullDir, () => { SetNativeEnabled(true); }, (n, d) => { if (n != "" && d == GetFullDir) { AddPanel(new FlashcardsPanel(ListPanel, n, GetFullDir), true); } StopEditing(d); }); }
public override bool CheckAnswer(string answer) { bool result = GetCurrentFlashcard().IsCorrectAnswer(answer); if (result) { Points++; Flashcards.Remove(CurrentFlashcard); if (--CardsLeft == 0) { IsOver = true; return(true); } } else { if (--Lives < 0) { IsOver = true; } } NextFlashcard(); return(result); }
public Flashcard GetFlashcardById(string id) { return(Flashcards.FirstOrDefault(x => x.Id == id)); }
public FlashcardsSettings(Flashcards _flashcards) { InitializeComponent(); flashcards = _flashcards; }
public override Flashcard GetCurrentFlashcard() { return(Flashcards.First()); }