public VocabularyBookStatistics(VocabularyBook book) { this.book = book; book.Words.OnAdd(word => { word.PropertyChanged += VocabularyWord_PropertyChanged; Refresh(); }); book.Words.OnRemove(word => { word.PropertyChanged -= VocabularyWord_PropertyChanged; Refresh(); }); }
public VocabularyBookController(VocabularyBook book) { ListView = new VocabularyListView { Dock = DockStyle.Fill, GridLines = Settings.Default.GridLines }; ListView.ItemSelectionChanged += OnSelectionChanged; ListView.Control.DoubleClick += OnDoubleClick; wordControllers = new List <VocabularyWordController>(); WordControllers = new ReadOnlyCollection <VocabularyWordController>(wordControllers); book.Words.OnAdd(AddItem); book.Words.OnRemove(RemoveItem); book.PropertyChanged += OnPropertyChanged; book.Statistics.PropertyChanged += OnStatisticsChanged; VocabularyBook = book; OnPropertyChanged(this, new PropertyChangedEventArgs(null)); }