/// ------------------------------------------------------------------------------------ /// <summary> /// Swaps the specified bookNew into the book filter and the specified bookOld out of the /// filter. /// </summary> /// <param name="bookOld">The old book to be swapped out of the filter.</param> /// <param name="bookNew">The new book to be swapped into the filter.</param> /// <param name="mainWnd">The window which contains the filter.</param> /// ------------------------------------------------------------------------------------ private void Swap(IScrBook bookOld, IScrBook bookNew, FwMainWnd mainWnd) { FilteredScrBooks filter = null; try { filter = (FilteredScrBooks)ReflectionHelper.GetProperty(mainWnd, "BookFilter"); } catch (System.MissingMethodException e) { Logger.WriteEvent(e.Message + " Main window: " + mainWnd.ToString()); } if (filter != null) { Logger.WriteEvent("Replacing book " + (bookOld != null ? bookOld.BookId : bookNew.BookId) + " in Book Filter for main window: " + mainWnd.ToString()); filter.SwapBooks(bookOld, bookNew); } }