Ejemplo n.º 1
0
    private void DoExportChapter()
    {
        var book    = CurrentReference.Book;
        var chapter = CurrentReference.Chapter;

        switch (Settings.CurrentView)
        {
        case ViewMode.ChapterVerses:
            SaveFileDialogMSWord.FileName = $"{book.Transcription} {chapter.Number}.docx";
            if (SaveFileDialogMSWord.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            SetFormDisabled(true);
            try
            {
                ExportDocX.Run(SaveFileDialogMSWord.FileName, book, chapter, true, true);
            }
            finally
            {
                SetFormDisabled(false);
            }
            break;

        case ViewMode.ChapterTranslation:
            SaveFileDialogRTF.FileName = $"{book.Transcription} {chapter.Number} Translation.rtf";
            if (SaveFileDialogRTF.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            TextBoxTranslations.SaveFile(SaveFileDialogRTF.FileName);
            if (Settings.AutoOpenExportedFile)
            {
                SystemManager.RunShell(SaveFileDialogRTF.FileName);
            }
            break;

        case ViewMode.ChapterOriginal:
            SaveFileDialogRTF.FileName = $"{book.Transcription} {chapter.Number} Hebrew.rtf";
            if (SaveFileDialogRTF.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            EditChapterOriginal.SaveFile(SaveFileDialogRTF.FileName);
            if (Settings.AutoOpenExportedFile)
            {
                SystemManager.RunShell(SaveFileDialogRTF.FileName);
            }
            break;

        default:
            throw new AdvNotImplementedException(Settings.CurrentView);
        }
    }
Ejemplo n.º 2
0
    private void DoExportBook()
    {
        var book = CurrentReference.Book;

        switch (Settings.CurrentView)
        {
        case ViewMode.ChapterVerses:
            SaveFileDialogMSWord.FileName = book.Transcription + ".docx";
            if (SaveFileDialogMSWord.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            var form = new ExportingForm();
            SetFormDisabled(true);
            try
            {
                form.ProgressBar.Value   = 0;
                form.ProgressBar.Maximum = SelectChapter.Items.Count;
                form.Show();
                form.Refresh();
                bool showProgress()
                {
                    form.ProgressBar.PerformStep();
                    Application.DoEvents();
                    return(form.CancelRequired);
                }
                ExportDocX.Run(SaveFileDialogMSWord.FileName, book, true, true, showProgress);
            }
            finally
            {
                SetFormDisabled(false);
                form.Close();
            }
            break;

        case ViewMode.BookELS50:
            SaveFileDialogRTF.FileName = book.Transcription + " ELS50.rtf";
            if (SaveFileDialogRTF.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            EditChapterELS50.SaveFile(SaveFileDialogRTF.FileName);
            if (Settings.AutoOpenExportedFile)
            {
                SystemManager.RunShell(SaveFileDialogRTF.FileName);
            }
            break;

        default:
            throw new AdvNotImplementedException(Settings.CurrentView);
        }
    }