public void Cost_2Books(int book1, int book2) { var set = new BookSet(); set.Add(book1); set.Add(book2); Assert.AreEqual(8 * 2 * 0.95, set.Cost()); }
public void Cost_3Books(int book1, int book2, int book3) { var set = new BookSet(); set.Add(book1); set.Add(book2); set.Add(book3); Assert.AreEqual(8 * 3 * 0.90, set.Cost()); }
public void Cost_4Books(int book1, int book2, int book3, int book4) { var set = new BookSet(); set.Add(book1); set.Add(book2); set.Add(book3); set.Add(book4); Assert.AreEqual(8 * 4 * 0.80, set.Cost()); }
public void Cost_4Books() { var set = new BookSet(); set.Add(1); set.Add(2); set.Add(3); set.Add(4); set.Add(5); Assert.AreEqual(8 * 5 * 0.75, set.Cost()); }
internal QuotationMarksDlg(Project project, BlockNavigatorViewModel navigatorViewModel, bool readOnly) { InitializeComponent(); m_project = project; m_project.AnalysisCompleted -= HandleAnalysisCompleted; m_project.AnalysisCompleted += HandleAnalysisCompleted; m_navigatorViewModel = navigatorViewModel; if (Settings.Default.QuoteMarksDialogShowGridView) { m_toolStripButtonGridView.Checked = true; } var books = new BookSet(); foreach (var bookId in m_navigatorViewModel.IncludedBooks) { books.Add(bookId); } m_scriptureReference.VerseControl.BooksPresentSet = books; m_scriptureReference.VerseControl.ShowEmptyBooks = false; m_scriptureReference.VerseControl.AllowVerseSegments = false; m_scriptureReference.VerseControl.Versification = m_navigatorViewModel.Versification; m_scriptureReference.VerseControl.VerseRefChanged += m_scriptureReference_VerseRefChanged; m_blocksViewer.Initialize(m_navigatorViewModel); m_navigatorViewModel.CurrentBlockChanged += HandleCurrentBlockChanged; SetupQuoteMarksComboBoxes(m_project.QuoteSystem); m_scriptureReference.VerseControl.GetLocalizedBookName = L10N.GetLocalizedBookNameFunc(m_scriptureReference.VerseControl.GetLocalizedBookName); HandleStringsLocalized(); LocalizeItemDlg.StringsLocalized += HandleStringsLocalized; m_blocksViewer.VisibleChanged += (sender, args) => this.SafeInvoke(() => { if (m_blocksViewer.Visible) { LoadBlock(); } }, GetType().FullName + " - anonymous delegate m_blocksViewer.VisibleChanged", ControlExtensions.ErrorHandlingAction.IgnoreIfDisposed); SetFilterControlsFromMode(); if (m_project.ProjectState == ProjectState.NeedsQuoteSystemConfirmation) { UpdateTestParse(false); } else { ShowTestResults(PercentageOfExpectedQuotesFound(m_project.Books), false); } if (readOnly) { MakeReadOnly(); } }
public AssignCharacterDlg(AssignCharacterViewModel viewModel) { InitializeComponent(); m_viewModel = viewModel; if (Settings.Default.AssignCharacterDialogFormSettings == null) { Settings.Default.AssignCharacterDialogFormSettings = FormSettings.Create(this); } m_txtCharacterFilter.CorrectHeight(); m_txtDeliveryFilter.CorrectHeight(); if (Settings.Default.AssignCharactersShowGridView) { m_toolStripButtonGridView.Checked = true; } var books = new BookSet(); foreach (var bookId in m_viewModel.IncludedBooks) { books.Add(bookId); } m_scriptureReference.VerseControl.BooksPresentSet = books; m_scriptureReference.VerseControl.ShowEmptyBooks = false; m_scriptureReference.VerseControl.AllowVerseSegments = false; m_scriptureReference.VerseControl.Versification = m_viewModel.Versification; m_scriptureReference.VerseControl.VerseRefChanged += m_scriptureReference_VerseRefChanged; m_scriptureReference.VerseControl.Disposed += (sender, args) => m_scriptureReference.VerseControl.VerseRefChanged -= m_scriptureReference_VerseRefChanged; m_blocksViewer.Initialize(m_viewModel, AssignCharacterViewModel.Character.GetCharacterIdForUi, block => block.Delivery); m_viewModel.CurrentBlockChanged += LoadBlock; UpdateProgressBarForMode(); HandleStringsLocalized(); LocalizeItemDlg.StringsLocalized += HandleStringsLocalized; m_listBoxCharacters.DisplayMember = "LocalizedDisplay"; m_originalDefaultFontForLists = m_listBoxCharacters.Font; SetFontsFromViewModel(); m_viewModel.AssignedBlocksIncremented += m_viewModel_AssignedBlocksIncremented; m_viewModel.UiFontSizeChanged += (sender, args) => SetFontsFromViewModel(); m_blocksViewer.VisibleChanged += LoadBlock; m_blocksViewer.Disposed += (sender, args) => m_blocksViewer.VisibleChanged -= LoadBlock; SetFilterControlsFromMode(); m_viewModel.CurrentBookSaved += UpdateSavedText; }
public static string BookSummary(this IEnumerable <BookScript> books) { var bookSet = new BookSet(); foreach (BookScript book in books) { bookSet.Add(book.BookId); } return(bookSet.CustomSummary()); }
public static BookSet ToBookSet(this IEnumerable <BookScript> books) { var bookSet = new BookSet(); foreach (BookScript book in books) { bookSet.Add(book.BookId); } return(bookSet); }
public static BookSet ToBookSet(this IEnumerable <Book> books) { var bookSet = new BookSet(); foreach (Book book in books) { bookSet.Add(book.Code); } return(bookSet); }
internal QuotationMarksDlg(Project project, BlockNavigatorViewModel navigatorViewModel, bool readOnly) { InitializeComponent(); m_project = project; m_project.AnalysisCompleted -= HandleAnalysisCompleted; m_project.AnalysisCompleted += HandleAnalysisCompleted; m_navigatorViewModel = navigatorViewModel; if (Settings.Default.QuoteMarksDialogShowGridView) { m_toolStripButtonGridView.Checked = true; } var books = new BookSet(); foreach (var bookId in m_navigatorViewModel.IncludedBooks) { books.Add(bookId); } m_scriptureReference.VerseControl.BooksPresentSet = books; m_scriptureReference.VerseControl.ShowEmptyBooks = false; m_scriptureReference.VerseControl.AllowVerseSegments = false; m_scriptureReference.VerseControl.Versification = m_navigatorViewModel.Versification; m_scriptureReference.VerseControl.VerseRefChanged += m_scriptureReference_VerseRefChanged; m_blocksViewer.Initialize(m_navigatorViewModel); m_navigatorViewModel.CurrentBlockChanged += HandleCurrentBlockChanged; SetupQuoteMarksComboBoxes(m_project.QuoteSystem); HandleStringsLocalized(); LocalizeItemDlg.StringsLocalized += HandleStringsLocalized; m_blocksViewer.VisibleChanged += (sender, args) => this.SafeInvoke(() => { if (m_blocksViewer.Visible) { LoadBlock(); } }, true); SetFilterControlsFromMode(); if (readOnly) { MakeReadOnly(); } }
public void Cost_1Book(int book) { var set = new BookSet(); set.Add(book); Assert.AreEqual(8, set.Cost()); }
public void CanAdd_DuplicateBook_ReturnFalse() { var set = new BookSet(); set.Add(1); Assert.IsFalse(set.CanAdd(1)); }
public void Add_DuplicateBook_Throws() { var set = new BookSet(); set.Add(1); Assert.Throws<InvalidOperationException>(() => set.Add(1)); }
internal QuotationMarksDlg(Project project, BlockNavigatorViewModel navigatorViewModel, bool readOnly, ProjectSettingsDlg parentDlg) { InitializeComponent(); Cursor.Current = Cursors.WaitCursor; m_project = project; m_project.AnalysisCompleted -= HandleAnalysisCompleted; m_project.AnalysisCompleted += HandleAnalysisCompleted; m_navigatorViewModel = navigatorViewModel; m_parentDlg = parentDlg; if (Settings.Default.QuoteMarksDialogShowGridView) { m_toolStripButtonGridView.Checked = true; } if (m_navigatorViewModel == null) { PreventNavigation(); } else { var books = new BookSet(); foreach (var bookId in m_navigatorViewModel.IncludedBooks) { books.Add(bookId); } m_scriptureReference.VerseControl.BooksPresentSet = books; m_scriptureReference.VerseControl.ShowEmptyBooks = false; m_scriptureReference.VerseControl.AllowVerseSegments = false; m_scriptureReference.VerseControl.Versification = m_navigatorViewModel.Versification; m_scriptureReference.VerseControl.VerseRefChanged += m_scriptureReference_VerseRefChanged; m_blocksViewer.Initialize(m_navigatorViewModel); m_navigatorViewModel.CurrentBlockChanged += HandleCurrentBlockChanged; m_scriptureReference.VerseControl.GetLocalizedBookName = L10N.GetLocalizedBookNameFunc(m_scriptureReference.VerseControl.GetLocalizedBookName); m_blocksViewer.VisibleChanged += (sender, args) => this.SafeInvoke(() => { if (m_blocksViewer.Visible) { LoadBlock(); } }, GetType().FullName + " - anonymous delegate m_blocksViewer.VisibleChanged", ControlExtensions.ErrorHandlingAction.IgnoreIfDisposed); } SetupQuoteMarksComboBoxes(m_project.QuoteSystem); if (m_project.IsLiveParatextProject && readOnly) { var wrapper = m_project.GetLiveParatextDataIfCompatible(false, checkForChangesInAvailableBooks: false); m_linkOverride.Visible = m_allowOverride = wrapper == null || !wrapper.UserCanEditProject; } try { HandleStringsLocalized(); LocalizeItemDlg <TMXDocument> .StringsLocalized += HandleStringsLocalized; SetFilterControlsFromMode(); if (m_project.ProjectState == ProjectState.NeedsQuoteSystemConfirmation) { UpdateTestParse(false); } ReadOnly = readOnly; } finally { Cursor.Current = Cursors.Default; } }