public AllList(IPreferences preferences) { if (manager == null) { throw new InvalidOperationException("Internal error. " + "BackendManager must be set beforehand."); } if (preferences == null) { throw new ArgumentNullException("preferences"); } backendManager = manager; tasks = new ObservableCollection <ITask> (); taskListsToHide = preferences.GetStringList( PreferencesKeys.HideInAllTaskList); preferences.SettingChanged += (prefs, settingKey) => { if (settingKey != PreferencesKeys.HideInAllTaskList) { return; } taskListsToHide = prefs.GetStringList( PreferencesKeys.HideInAllTaskList); UpdateList(); }; observedLists = new List <ITaskList> (); UpdateList(); ((INotifyCollectionChanged)manager.TaskLists) .CollectionChanged += delegate { UpdateList(); }; }