public static void LoadLessons(Lesson[] selectedLessons) { InsertData.Lessons = selectedLessons; DataManager.LoadSentences(selectedLessons); InsertData.Sentences = AppData.Sentences; AppData.Sentences = null; Util.SortByRandom(InsertData.Sentences); GetNextSentence(); }
public static void LoadLessons(Lesson[] selectedLessons) { FlashcardsData.Lessons = selectedLessons; DataManager.LoadKanjis(selectedLessons); FlashcardsData.Kanjis.AddRange(AppData.Kanjis); AppData.Kanjis = null; GetNextKanji(); FlashcardsData.ItemsCorrect = 0; FlashcardsData.ItemsWrong = 0; FlashcardsData.ItemsLeft = FlashcardsData.Kanjis.Count; }
private void loadLessonsButton_Click(object sender, RoutedEventArgs e) { if (setsListbox.SelectedItems.Count > 0) { Lesson[] selectedLessons = new Lesson[setsListbox.SelectedItems.Count]; for (int i = 0; i < selectedLessons.Length; ++i) { selectedLessons[i] = setsListbox.SelectedItems[i] as Lesson; } FlashcardsController.LoadLessons(selectedLessons); NavigationService.Navigate(new Uri("/Pages/PracticeFlashcardsPage.xaml", UriKind.Relative)); setsListbox.SelectedItems.Clear(); } else { MessageBox.Show("Keine Lektion ausgewählt!"); } }
public Sentence[] GetSentences(Lesson[] lessons) { int[] ids = ExtractIDs(lessons); return (from c in sentences where ids.Contains(c.lessonID) select c).ToArray(); }
public Word[] GetWords(Lesson lesson) { return (from c in words where c.lessonID == lesson.id select c).ToArray(); }
public static void LoadLessons(Lesson[] selectedLessons) { ConjugationData.Lessons = selectedLessons; Word.EType[] types = { Word.EType.verb1, Word.EType.verb2, Word.EType.verb3, }; DataManager.LoadWords(ConjugationData.Lessons, types); ConjugationData.Words = AppData.Words; AppData.Words = null; rand = new Random(); Util.SortByRandom(ConjugationData.Words); itemIndex = 0; ConjugationData.ItemsCorrect = 0; ConjugationData.ItemsWrong = 0; ConjugationData.ItemsLeft = ConjugationData.Words.Length; ConjugationData.ActiveWords = new Word [ConjugationData.maxActiveConjugationWordsCount]; ConjugationData.TargetWords = new String [ConjugationData.maxActiveConjugationWordsCount]; ConjugationData.TargetForms = new ConjugationData.ETargetForm[ConjugationData.maxActiveConjugationWordsCount]; }
public static void LoadWords(Lesson lesson) { AppData.Words = context.GetWords(lesson); AppData.SelectedLesson = lesson; }
public Kanji[] GetKanjis(Lesson[] lessons) { int[] ids = ExtractIDs(lessons); return (from c in kanjis where ids.Contains(c.lessonID) select c).ToArray(); }
private static String AddLessons(AppStreamReader sr, int itemCount) { int lessonID = context.GetLastLessonID(); int importedLessons = 0; int importedWords = 0; int importedSentences = 0; int importedKanjis = 0; for (int i = 0; i < itemCount; ++i) { String line = sr.ReadLine(); Lesson lesson = new Lesson(line); lesson.id = ++lessonID; switch (lesson.type) { case 0: importedWords += ReadVocabLesson(sr, lesson); break; case 1: importedSentences += ReadInsertLesson(sr, lesson); break; case 2: break; case 3: importedKanjis += ReadKanjiLesson(sr, lesson); break; case 4: break; } context.lessons.InsertOnSubmit(lesson); ++importedLessons; } StringBuilder sb = new StringBuilder(); sb.AppendLine("Hinzugefügte Lektionen\t: " + importedLessons); sb.AppendLine("Hinzugefügte Wörter\t: " + importedWords); sb.AppendLine("Hinzugefügte Lückentexte\t: " + importedSentences); sb.AppendLine("Hinzugefügte Kanjis\t: " + importedKanjis); return sb.ToString(); }
private static int WriteKanjiLesson(AppStreamWriter sw, Lesson lesson) { LoadKanjis(lesson); foreach (Kanji kanji in AppData.Kanjis) { sw.WriteLine(kanji.ToExportString()); } return AppData.Kanjis.Length; }
private int[] ExtractIDs(Lesson[] lessons) { int[] ids = new int[lessons.Length]; for (int i = 0; i < ids.Length; ++i) { ids[i] = lessons[i].id; } return ids; }
private static String UpdateLessons(AppStreamReader sr, int itemCount) { for (int i = 0; i < itemCount; ++i) { String line = sr.ReadLine(); Lesson newLesson = new Lesson(line); Lesson oldLesson = context.GetLesson(newLesson.id); oldLesson.Update(newLesson); } StringBuilder sb = new StringBuilder(); sb.AppendLine("Aktualisierte Lektionen\t: " + itemCount); return sb.ToString(); }
private static int WriteInsertLesson(AppStreamWriter sw, Lesson lesson) { LoadSentences(lesson); foreach (Sentence sentence in AppData.Sentences) { sw.WriteLine(sentence.ToExportString()); } return AppData.Sentences.Length; }
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 int ReadKanjiLesson(AppStreamReader sr, Lesson lesson) { Kanji[] kanjis = new Kanji[lesson.size]; for (int i = 0; i < kanjis.Length; ++i) { String line = sr.ReadLine(); kanjis[i] = new Kanji(line, lesson.id); } context.kanjis.InsertAllOnSubmit(kanjis); return kanjis.Length; }
private static int ReadInsertLesson(AppStreamReader sr, Lesson lesson) { Sentence[] sentences = new Sentence[lesson.size]; for (int i = 0; i < sentences.Length; ++i) { String line = sr.ReadLine(); sentences[i] = new Sentence(line, lesson.id); } context.sentences.InsertAllOnSubmit(sentences); return sentences.Length; }
public Word[] GetWords(Lesson[] lessons) { int[] ids = ExtractIDs(lessons); return (from c in words where ids.Contains(c.lessonID) select c).ToArray(); }
private static int WriteVocabLesson(AppStreamWriter sw, Lesson lesson) { LoadWords(lesson); foreach (Word word in AppData.Words) { sw.WriteLine(word.ToExportString()); } return AppData.Words.Length; }
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 void loadLessonsButton_Click(object sender, RoutedEventArgs e) { if (setsListbox.SelectedItems.Count > 0) { GetLoadOptions(); GetSortOrder(); Lesson[] selectedLessons = new Lesson[setsListbox.SelectedItems.Count]; for (int i = 0; i < selectedLessons.Length; ++i) { selectedLessons[i] = setsListbox.SelectedItems[i] as Lesson; } VocabController.LoadLessons(selectedLessons); if (VocabData.Words.Count == 0) { MessageBox.Show("Keine Wörter in den gewählten Lektionen mehr verfügbar!"); VocabController.Deinitialize(); return; } NavigationService.Navigate(new Uri("/Pages/PracticeVocabPage.xaml", UriKind.Relative)); setsListbox.SelectedItems.Clear(); } else { MessageBox.Show("Keine Lektion ausgewählt!"); } }
public Kanji[] GetKanjis(Lesson lesson) { return (from c in kanjis where c.lessonID == lesson.id select c).ToArray(); }
public static void LoadWords(Lesson[] lessons) { AppData.Words = context.GetWords(lessons); }
/// <summary> /// <para>Updates the Lesson</para> /// <para>updateString Pattern Should Be:</para> /// <para>id|name|size</para> /// <para>type can not be changed yet</para> /// </summary> //public void Update(String updateString) //{ // String[] textFragments = updateString.Split('|'); // name = textFragments[1]; // size = Convert.ToInt32(textFragments[2]); //} /// <summary> /// Updates the Lesson name with the name in the newer Lesson parameter /// </summary> /// <param name="newer"></param> public void Update(Lesson value) { name = value.name; size = value.size; }
public static void LoadWords(Lesson[] lessons, Word.EType[] types) { AppData.Words = context.GetWords(lessons, types); }
public static void LoadLessons(Lesson[] lessons) { CombineWordsData.Lessons = lessons; DataManager.LoadWords(CombineWordsData.Lessons, Util.ExtractTypes(AppSettings.LoadOptions)); DataManager.LoadKanjis(); List<char> sourceSigns = new List<char>(); //TODO: for now i take my signs for the buttons from the kanjis, later i could use an extra sign table with all //japanese signs in it, so that i don't have to check if a sign is multiple times in the sourceSigns array for (int i = 0; i < AppData.Kanjis.Length; ++i) { sourceSigns.Add(AppData.Kanjis[i].kanji[0]); } CombineWordsData.Words = AppData.Words; CombineWordsData.SourceSigns = sourceSigns.Distinct().ToArray(); AppData.Words = null; Util.SortByRandom(CombineWordsData.SourceSigns); Util.SortByRandom(CombineWordsData.Words); CombineWordsData.ItemIndex = -1; }
public static void LoadLessons(Lesson[] lessons) { DataManager.LoadWords(lessons, Util.ExtractTypes(AppSettings.LoadOptions)); LoadLessons(); }
public Lesson[] GetLessons(Lesson.EType setType) { return (from c in lessons where c.type == (int)setType select c).ToArray(); }
public Sentence[] GetSentences(Lesson lesson) { return (from c in sentences where c.lessonID == lesson.id select c).ToArray(); }
/// <summary> /// <para>Updates the Lesson</para> /// <para>updateString Pattern Should Be:</para> /// <para>id|name|size</para> /// <para>type can not be changed yet</para> /// </summary> //public void Update(String updateString) //{ // String[] textFragments = updateString.Split('|'); // name = textFragments[1]; // size = Convert.ToInt32(textFragments[2]); //} /// <summary> /// Updates the Lesson name with the name in the newer Lesson parameter /// </summary> /// <param name="newer"></param> public void Update(Lesson newer) { name = newer.name; }
public static void LoadSentences(Lesson[] lessons) { AppData.Sentences = context.GetSentences(lessons); }