public void FillControl(Word word) { //if(word.original == null) //{ // this.word = word; //} //else //{ // this.word = word.original; //} this.word = word; kanaTextbox.Text = word.kana; kanjiTextbox.Text = word.kanji == null ? "" : word.kanji; translationTextbox.Text = word.translation; descriptionTextbox.Text = word.description == null ? "" : word.description; showFlagListbox.SelectedIndex = word.showFlags; if (word.type == -1) { typeListbox.SelectedIndex = (int)Word.EType.other; } else { typeListbox.SelectedIndex = word.type; } }
public StatisticsWordItem(Word word, bool showPercentage) { InitializeComponent(); this.word = word; wordTextblock.Text = word.ToDetailString(); if ((word.correctTranslation | word.wrongTranslation) == 0) { kanaGrid.Visibility = System.Windows.Visibility.Collapsed; kanaProgressBar.Visibility = System.Windows.Visibility.Collapsed; } else { correct = 100 * word.correctTranslation / (word.correctTranslation + word.wrongTranslation); kanaProgressBar.Value = correct; if (showPercentage) { correctKanaTextblock.Text = correct + "%"; wrongKanaTextblock.Text = 100 - correct + "%"; } else { correctKanaTextblock.Text = word.correctTranslation.ToString(); wrongKanaTextblock.Text = word.wrongTranslation.ToString(); } } if ((word.correctJapanese | word.wrongJapanese) > 0) { correctKanji = 100 * word.correctJapanese / (word.correctJapanese + word.wrongJapanese); kanjiProgressBar.Value = correctKanji; if (showPercentage) { correctKanjiTextblock.Text = correctKanji + "%"; wrongKanjiTextblock.Text = 100 - correctKanji + "%"; } else { correctKanjiTextblock.Text = word.correctJapanese.ToString(); wrongKanjiTextblock.Text = word.wrongJapanese.ToString(); } } else { kanjiGrid.Visibility = System.Windows.Visibility.Collapsed; kanjiProgressBar.Visibility = System.Windows.Visibility.Collapsed; } }
public DetailWordItem(Word word) { InitializeComponent(); ++itemCounter; if(deselectedBrush == null) { deselectedBrush = wordTextblock.Foreground as SolidColorBrush; selectedBrush = new SolidColorBrush(Color.FromArgb(255, 100, 100, 255)); } this.value = word; wordTextblock.Text = word.ToDetailString(); descriptionTextblock.Text = word.ToDescriptionString(); }
public void FillControl(Word word) { //this.word = word; //kanaTextbox .Text = word.kana; //kanjiTextbox .Text = word.kanji == null ? "" : word.kanji; //translationTextbox.Text = word.translation; //descriptionTextbox.Text = word.description == null ? "" : word.description; //showFlagListbox.SelectedIndex = word.showFlags; //if (word.type == -1) //{ // typeListbox.SelectedIndex = (int)Word.EType.other; //} //else //{ // typeListbox.SelectedIndex = word.type; //} }
public Word(Word source) { id = source.id; kana = source.kana; kanji = source.kanji; translation = source.translation; description = source.description; correctTranslation = source.correctTranslation; wrongTranslation = source.wrongTranslation; correctJapanese = source.correctJapanese; wrongJapanese = source.wrongJapanese; type = source.type; showFlags = source.showFlags; timeStampJapanese = source.timeStampJapanese; timeStampTransl = source.timeStampTransl; lessonID = source.lessonID; }
public void Update(Word word, bool showPercentage, bool showTranslation) { wordTextblock.Text = word.ToDetailString(); if((word.CorrectWrongCountTranslation == 0 && !showTranslation) || (word.CorrectWrongCountJapanese == 0 && showTranslation)) { HideProgressBar(); return; } if(showTranslation) { correctWrongRelation = (int)(100.0f * word.CorrectWrongRelationTranslation); gerJapTextblock.Text = "Deutsch -> Japanisch"; correctTextblock.Text = word.correctTranslation.ToString(); wrongTextblock.Text = word.wrongTranslation.ToString(); } else { correctWrongRelation = (int)(100.0f * word.CorrectWrongRelationJapanese); gerJapTextblock.Text = "Japanisch -> Deutsch"; correctTextblock.Text = word.correctJapanese.ToString(); wrongTextblock.Text = word.wrongJapanese.ToString(); } progressBar.Value = correctWrongRelation; if (showPercentage) { correctTextblock.Text = correctWrongRelation + "%"; wrongTextblock.Text = 100 - correctWrongRelation + "%"; } }
private static String GetTargetWord(String sourceWord, Word.EType sourceWordType, ConjugationData.ETargetForm targetForm) { //before i conjugate the wort into the target form i first bring the word from the masu into the ru form //the thing is, normaly the word whould already be in ru form but i saved all verbs in masu form //so i just convert them at the begining, later i will convert all verbs into the ru form before so //i don't have do convert it here sourceWord = GetRuVerb(sourceWord, sourceWordType); switch (targetForm) { case ConjugationData.ETargetForm.ruForm : return GetRuVerb(sourceWord, sourceWordType); case ConjugationData.ETargetForm.naiForm : return GetNaiVerb(sourceWord, sourceWordType); case ConjugationData.ETargetForm.naiPastForm : return GetNaiVerbPast(sourceWord, sourceWordType); case ConjugationData.ETargetForm.masuForm : return GetMasuVerb(sourceWord, sourceWordType); case ConjugationData.ETargetForm.masuNegativeForm : return GetMasuVerbNegative(sourceWord, sourceWordType); case ConjugationData.ETargetForm.masuPastForm : return GetMasuVerbPast(sourceWord, sourceWordType); case ConjugationData.ETargetForm.masuPastNegativeForm: return GetMasuVerbPastNegative(sourceWord, sourceWordType); case ConjugationData.ETargetForm.teForm : return GetTeVerb(sourceWord, sourceWordType); case ConjugationData.ETargetForm.taForm : return GetTaVerb(sourceWord, sourceWordType); case ConjugationData.ETargetForm.imperativeForm : return GetImperativeVerb(sourceWord, sourceWordType); case ConjugationData.ETargetForm.prohibitiveForm : return GetProhibitiveVerb(sourceWord, sourceWordType); case ConjugationData.ETargetForm.volitionalForm : return GetVolitionalVerb(sourceWord, sourceWordType); case ConjugationData.ETargetForm.conditionalForm : return GetConditionalVerb(sourceWord, sourceWordType); case ConjugationData.ETargetForm.tai : return GetTaiVerb(sourceWord, sourceWordType); case ConjugationData.ETargetForm.sugi : return GetSugiVerb(sourceWord, sourceWordType); case ConjugationData.ETargetForm.yasui : return GetYasuiVerb(sourceWord, sourceWordType); case ConjugationData.ETargetForm.nikui : return GetNikuiVerb(sourceWord, sourceWordType); case ConjugationData.ETargetForm.potentialVerb : return GetPotentialVerb(sourceWord, sourceWordType); case ConjugationData.ETargetForm.passiveVerb : return GetPassiveVerb(sourceWord, sourceWordType); case ConjugationData.ETargetForm.causativeVerb : return GetCausativeVerb(sourceWord, sourceWordType); } return ""; }
private static String GetProhibitiveVerb(String sourceWord, Word.EType sourceWordType) { return sourceWord + "な"; }
private static String GetNaiVerbPast(String sourceWord, Word.EType sourceWordType) { String naiForm = GetNaiVerb(sourceWord, sourceWordType); return naiForm.Substring(0, naiForm.Length - 1) + "かった"; }
private static String GetMasuVerbPastNegative(String sourceWord, Word.EType sourceWordType) { String masuForm = GetMasuVerb(sourceWord, sourceWordType); return masuForm.Substring(0, masuForm.Length - 1) + "せんでした"; }
public StatisticsItem(Word word, bool showPercentage, bool showTranslation) { InitializeComponent(); Update(word, showPercentage, showTranslation); }
public static void LoadWords(Lesson[] lessons, Word.EType[] types) { AppData.Words = context.GetWords(lessons, types); }
public Word[] GetWords(Lesson[] lessons, Word.EType[] types) { int[] ids = ExtractIDs(lessons); return (from c in words where ids.Contains(c.lessonID) && types.Contains((Word.EType)c.type) select c).ToArray(); }
private static String AddWords(AppStreamReader sr, int itemCount) { Dictionary<int, int> lessonsDict = new Dictionary<int, int>(); for (int i = 0; i < itemCount; ++i) { String line = sr.ReadLine(); String[] parts = line.Split('|'); int lessonID = Convert.ToInt32(parts[0]); if (lessonsDict.ContainsKey(lessonID)) { lessonsDict[lessonID] += 1; } else { lessonsDict.Add(lessonID, 1); } Word w = new Word(line, lessonID); context.words.InsertOnSubmit(w); } foreach (KeyValuePair<int, int> pair in lessonsDict) { Lesson l = context.GetLesson(pair.Key); l.size += pair.Value; } StringBuilder sb = new StringBuilder(); sb.AppendLine("Wörter zu bestehenden Lektionen hinzugefügt: " + itemCount); return sb.ToString(); }
private static String GetVolitionalVerb(String sourceWord, Word.EType sourceWordType) { switch (sourceWordType) { case Word.EType.verb1: return GetVolitionalVerb1(sourceWord); case Word.EType.verb2: return GetVolitionalVerb2(sourceWord); case Word.EType.verb3: return GetVolitionalVerb3(sourceWord); } return ""; }
public int CompareTranslationDeccending(Word x, Word y) { return (int)((x.CorrectWrongRelationTranslation * 100) - (y.CorrectWrongRelationTranslation * 100)); }
public int CompareJapaneseDeccending(Word x, Word y) { return (int)((x.CorrectWrongRelationJapanese * 100) - (y.CorrectWrongRelationJapanese * 100)); }
private static void ResetWord(Word w) { w.correctTranslation = 0; w.wrongTranslation = 0; w.correctJapanese = 0; w.wrongJapanese = 0; }
private static int ReadVocabLesson(AppStreamReader sr, Lesson lesson) { Word[] words = new Word[lesson.size]; for (int i = 0; i < words.Length; ++i) { String line = sr.ReadLine(); words[i] = new Word(line, lesson.id); AppSettings.TimeStamp = Math.Max(AppSettings.TimeStamp, words[i].TimeStampTransl); AppSettings.TimeStamp = Math.Max(AppSettings.TimeStamp, words[i].TimeStampJapanese); } context.words.InsertAllOnSubmit(words); return words.Length; }
private static String GetYasuiVerb(String sourceWord, Word.EType sourceWordType) { String masuVerb = GetMasuVerb(sourceWord, sourceWordType); return masuVerb.Substring(0, masuVerb.Length - 2) + "やすい"; }
public void Update(Word word) { wordTextblock.Text = word.ToDetailString(); descriptionTextblock.Text = word.ToDescriptionString(); }