private void AddNewViewModel() { var next = new WordEditorViewModel(); this.Words.Add(next); next.ContentChanged += this.NewWord_ContentChanged; }
private void NewWord_ContentChanged(WordEditorViewModel sender) { if (sender.Status != WordEditorStatus.New) { sender.ContentChanged -= this.NewWord_ContentChanged; this.AddNewViewModel(); } }
public void SetMajor(WordEditorViewModel word) { Debug.Assert(word != this.MajorWord); if (string.IsNullOrWhiteSpace(word.Text) || word.Text.AsLines().Length > 1) { return; } if (this.MajorWord != null) { this.MajorWord.Status = WordEditorStatus.Value; } this.MajorWord = word; this.MajorWord.Status = WordEditorStatus.Major; }
public void Remove(WordEditorViewModel word) { Debug.Assert(word != this.MajorWord); this.Words.Remove(word); }