protected override void Internal_UpdateInMemory(BookViewModel book) { BookFacade.Update(book); int index = BookSource.IndexOf(BookSource.Where(b => b.ID.Equals(book.ID)).Single()); BookSource[index] = book; if (SearchedBooks != null) { index = SearchedBooks.IndexOf(SearchedBooks.Where(b => b.ID.Equals(book.ID)).Single()); SearchedBooks[index] = book; } RaisePropertyChanged(PropertyNameUtility.GetPropertyName(() => OnStage)); }
protected virtual void Internal_UpdateInMemory(BookViewModel book) { BookFacade.Update(book); int index = BookSource.IndexOf(BookSource.Where(b => b.ID.Equals(book.ID)).Single()); BookSource[index] = book; RaisePropertyChanged(PropertyNameUtility.GetPropertyName(() => OnStage)); if (observer != null) { observer.OnNext(new BookCollectionChanged() { Target = book, TargetChange = new BookCollectionChanged.Update() }); } }
public void Search(string searchingText) { Task.Factory.StartNew(() => { if (string.IsNullOrEmpty(searchingText)) { SearchedBooks = null; OnSearchCleared(new EventArgs()); } else { s_logger.Debug($"Search Word:{searchingText}"); SearchedBooks = new ObservableCollection <BookViewModel>(BookSource.Where(b => AuthorNameContainsSearchText(b, searchingText) || TitleContainsSearchText(b, searchingText))); OnSearched(new SearchedEventArgs(searchingText, _previousSearchingText)); } _previousSearchingText = searchingText; }); }