public AddWord() { InitializeComponent(); //Binding the created word model = new WordBindingModel(); this.DataContext = model; }
private void AddWord_Click(object sender, RoutedEventArgs e) { AddWord addWord = new AddWord(); addWord.ShowDialog(); if (addWord.DialogResult == true) { WordBindingModel model = addWord.newWord; //Add to the collection controller.AddWord(model); } }
//Add Word internal void AddWord(WordBindingModel model) { Word newWord = new Word() { ID = GenerateId(), ForeignWord = model.ForaignWord, Meaning = model.Meaning, Gender = model.Gender }; words.Add(newWord); words.Sort(); HelperFunctions.PutInTheRightPlace(views, newWord); SaveChanges(); }
//Add Word public void AddWord(WordBindingModel model) { current.AddWord(model); }