private void WordsControl_Load(object sender, EventArgs e) { var wordsStorage = WordStorage.getInstance(); loadWords(wordsStorage.getWords()); wordsStorage.wordsUpdated += (words) => { runOnGui(() => { loadWords(words); }); }; wordsStorage.wordUpdated += (word) => { runOnGui(() => { EditWordRowControl item = wordControls.Find(control => control.Id == word.Id); if (item != null) { item.Names = word.Names; item.Code = word.Code; } else { var newItem = createWordControl(word); FLPlist.ScrollControlIntoView(newItem); } }); }; wordsStorage.wordDeleted += removeWord; }
void createWordCache() { searchOptimizedWords = WordStorage.getInstance().getWords().Select((word) => new SearchOptimizedWord() { Word = word, Names = word.Names.Split().Select(name => name.Trim()).ToArray() }).ToList(); search(); }
private void BaddWord_Click(object sender, EventArgs e) { WordStorage.getInstance().AddWord(new Word() { Id = WordStorage.getInstance().getNextId(), Code = "3F", Names = "", }); }
private void TBname_TextChanged(object sender, EventArgs e) { var word = WordStorage.getInstance().getWordById(Id); if (word.Names != TBname.Text) { word.Names = TBname.Text; WordStorage.getInstance().UpdateWord(word); } }
private void TBcode_TextChanged(object sender, EventArgs e) { updateLetter(); var word = WordStorage.getInstance().getWordById(Id); if (word.Code != TBcode.Text) { word.Code = TBcode.Text; WordStorage.getInstance().UpdateWord(word); } }
public SearchControl() { InitializeComponent(); createWordCache(); var wordStorage = WordStorage.getInstance(); wordStorage.wordDeleted += (_) => { createWordCache(); }; wordStorage.wordsUpdated += (_) => { createWordCache(); }; wordStorage.wordUpdated += (_) => { createWordCache(); }; setupList(); }
private void Pdelete_Click(object sender, EventArgs e) { if (SettingsStorage.getInstance().getSettings().ConfirmDelete) { var confirmResult = MessageBox.Show("Are you sure to delete this item ??", "Confirm Delete!!", MessageBoxButtons.YesNo); ParentForm.Show(); if (confirmResult == DialogResult.Yes) { WordStorage.getInstance().removeWord(Id); } } else { WordStorage.getInstance().removeWord(Id); } }