Пример #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;
        }
Пример #2
0
 void createWordCache()
 {
     searchOptimizedWords = WordStorage.getInstance().getWords().Select((word) => new SearchOptimizedWord()
     {
         Word  = word,
         Names = word.Names.Split().Select(name => name.Trim()).ToArray()
     }).ToList();
     search();
 }
Пример #3
0
 private void BaddWord_Click(object sender, EventArgs e)
 {
     WordStorage.getInstance().AddWord(new Word()
     {
         Id    = WordStorage.getInstance().getNextId(),
         Code  = "3F",
         Names = "",
     });
 }
Пример #4
0
        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);
            }
        }
Пример #5
0
        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);
            }
        }
Пример #6
0
        public SearchControl()
        {
            InitializeComponent();
            createWordCache();
            var wordStorage = WordStorage.getInstance();

            wordStorage.wordDeleted += (_) => {
                createWordCache();
            };
            wordStorage.wordsUpdated += (_) => {
                createWordCache();
            };
            wordStorage.wordUpdated += (_) => {
                createWordCache();
            };
            setupList();
        }
Пример #7
0
 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);
     }
 }