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;
        }
Exemple #2
0
        private void BtnOk_Click(object sender, EventArgs e)
        {
            foreach (var book in m_project.AvailableBooks)
            {
                book.IncludeInScript = m_includeInScript[book.Code];

                if (!book.IncludeInScript)
                {
                    continue;
                }

                var bookScript = m_project.IncludedBooks.Single(b => b.BookId == book.Code);
                if (bookScript.SingleVoice != m_multiVoice[book.Code])
                {
                    continue;
                }

                bookScript.SingleVoice = !m_multiVoice[book.Code];
                Analytics.Track("SetSingleVoice", new Dictionary <string, string>
                {
                    { "book", book.Code },
                    { "singleVoice", bookScript.SingleVoice.ToString() },
                    { "method", "ScriptureRangeSelectionDlg.m_btnOk_Click" }
                });

                if (!bookScript.SingleVoice)
                {
                    continue;
                }

                using (var model = new AssignCharacterViewModel(m_project))
                    model.AssignNarratorForRemainingBlocksInBook(bookScript);
            }
            m_project.BookSelectionStatus = BookSelectionStatus.Reviewed;

            Analytics.Track("SelectBooks", new Dictionary <string, string> {
                { "bookSummary", m_project.BookSelectionSummary }
            });
        }
 public AddCharacterDlg(AssignCharacterViewModel viewModel)
 {
     InitializeComponent();
     m_viewModel = viewModel;
     ShowCharactersInBook();
 }