Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        public EditWordRowControl createWordControl(Word word)
        {
            var wordItem = new EditWordRowControl();

            wordItem.Id    = word.Id;
            wordItem.Names = word.Names;
            wordItem.Code  = word.Code;
            FLPlist.Controls.Add(wordItem);
            wordControls.Add(wordItem);
            return(wordItem);
        }