void DisplayLexims(int themeID) { Lexemes.Clear(); System.GC.Collect(); ILexemGateway lexemGateway = Gateway.LexemGateway; Lexemes.LexemeDictionary = lexemGateway.GetLexemes(themeID); this.ThemeView.LeximListBox.ClearAllItems(); foreach (Lexeme lex in Lexemes.LexemeCollection) { LeximDTView ldt = new LeximDTView(lex.ID, lex.ParentThemeID, lex.Word, lex.Picture, lex.Sound); this.ThemeView.LeximListBox.AddDisplayLexim(ldt, this.ThemeView.Play); } if (Lexemes.LexemeCollection.Count > 0) { this.ThemeView.LeximListBox.SetSelectionAt(0); } else { this.ThemeView.DisplayLexim(new LeximDTView(0, themeID, string.Empty, null, null), this.ThemeView.Play); } }
void ThemeView_OnSaveLexim(LeximDTView leximDT) { try { Lexeme lexim = new Lexeme(leximDT.ID, leximDT.ParentThemeID, leximDT.Word, leximDT.Picture, leximDT.Sound); if (lexim.ID == 0) { leximDT.ID = LexemGateway.AddLexeme(lexim); this.ThemeView.LeximListBox.InsertLexim(0, leximDT, this.ThemeView.Play); this.ThemeView.LeximListBox.SetSelectionAt(0); } else { LexemGateway.UpdateLexeme(lexim); this.ThemeView.LeximListBox.UpdateLexim(leximDT); } } catch (Exception ex) { this.HandleException("Could not add or update a word ", ex); } }
void ThemeView_OnLeximSelectionChanged(LeximDTView leximDT) { this.ThemeView.DisplayLexim(leximDT, this.ThemeView.Play); }