public static void recordMistake(Verbiage ve, string status) { mistakes.Add(new Verbiage(ve)); StreamWriter SW; SW = File.AppendText(basedir + @"mistakes.txt"); SW.WriteLine((status + " " + ve.Infinitive + ", " + ve.Pronoun.ToString() + " " + ve.ConjugatedVerb + ", " + ve.Conjugation.ToString()).PadRight(50) + " " + DateTime.Now); SW.Close(); for (int i = 0; i < 1; i++) // down to 1 from 10 ! { infinitives.Add(ve.Infinitive); } // re-randomize List <string> tmpList = infinitives; infinitives = new List <string>(); int index; while (tmpList.Count > 0) { index = r.Next(0, tmpList.Count); infinitives.Add(tmpList.ElementAt(index)); tmpList.RemoveAt(index); } return; }
private void formNextAction() { switch (promptState) { case PromptState.answering: { verbiage = Verbs.GetAConjugation(conjugation); verbiageList.Add(verbiage); label1.Text = verbiage.Infinitive; label2.Text = verbiage.Pronoun.ToString(); label3.Text = ""; //if (verbiage.IsIrregular) //{ // label3.Text = "Irregular"; //} promptState = PromptState.prompting; } break; case PromptState.prompting: { label1.Text = ""; label3.Text = ""; label2.Text = verbiage.Pronoun.ToString() + " " + verbiage.ConjugatedVerb; promptState = PromptState.answering; } break; } }
private void Window_KeyDown(object sender, KeyEventArgs e) { KeyPad.Hit(e); if (!e.Handled) { Verbiage.Hit(e); } Focus(); }
private void Good_Click(object sender, EventArgs e) { Verbiage v = verbiage; #if (compileunwanted) ve; if (gobackIndex > 0) { ve = vocabEntryList[vocabEntryList.Count - gobackIndex]; } else { ve = vocabEntry; } vocab.recordMistake(ve, "OK"); label3.Text = "surprise noted for " + ve.portuguese; #endif }
public static void removeEntries(Verbiage ve) { #if (compileunwanted) VocabEntry vocabEntry; List <int> indexList = new List <int>(); for (int i = vocabList.Count - 1; i >= 0; i--) { vocabEntry = vocabList[i]; if (vocabEntry.portuguese == ve.portuguese) { indexList.Add(i); } } foreach (int i in indexList) { vocabList.RemoveAt(i); } #endif return; }
static public Verbiage GetAConjugation(Conjugation con) { string infinitive; string conjugatedVerb; Conjugation conjugation = con; PersonalPronoun pronoun; int index; if (personalPronouns.Count * infinitives.Count <= historyList.Count) { // for really small datasets, elminate possible endless loop historyList.RemoveRange(0, historyList.Count); } do { pronoun = getPersonalPronoun(); index = r.Next(0, infinitives.Count); } while (History.isInHistory(index, pronoun, historyList)); History h = new History(index, pronoun); historyList.Add(h); infinitive = infinitives[index]; #if (pooledregulars) infinitive = Regulars.SubstituteRegular(infinitive); #endif conjugatedVerb = conjugateVerb(infinitive, pronoun, conjugation); bool isIrregular = Verbs.isIrregular(infinitive, conjugation); Verbiage verbiage = new Verbiage(infinitive, conjugatedVerb, pronoun, conjugation, isIrregular); return(verbiage); }
public Form1() { InitializeComponent(); conjugation = Conjugation.Present; verbiageList = new List <Verbiage>(); verbiage = null; }