Exemple #1
0
        ///-------------------------------------------------------------------------------
        /// <summary>
        /// If the user didn't choose cancel, save the controls' values.
        /// </summary>
        /// <param name="e"></param>
        ///-------------------------------------------------------------------------------
        protected override void OnClosing(CancelEventArgs e)
        {
            // If the scripture range is selected, then make sure both scripture references are
            // valid. Focus the incorrect one.
            if (this.DialogResult == DialogResult.OK && radImportRange.Checked)
            {
                if (!scrPsgFrom.Valid)
                {
                    scrPsgFrom.Focus();
                    e.Cancel = true;
                    return;
                }
                if (!scrPsgTo.Valid)
                {
                    scrPsgTo.Focus();
                    e.Cancel = true;
                    return;
                }
            }
            else if (DialogResult == DialogResult.OK && radImportEntire.Checked)
            {
                m_importSettings.StartRef = StartRef;
                m_importSettings.EndRef   = EndRef;
                m_importSettings.SaveSettings();
            }

            base.OnClosing(e);

            if (this.DialogResult == DialogResult.OK)
            {
                ImportEntire          = radImportEntire.Checked;
                ImportTranslation     = chkTranslation.Checked;
                ImportBackTranslation = chkBackTranslation.Checked;
                ImportBookIntros      = chkBookIntros.Checked;
                ImportAnnotations     = chkOther.Checked;
                s_StartRef[m_cache]   = scrPsgFrom.ScReference;
                s_EndRef[m_cache]     = scrPsgTo.ScReference;
                if (m_importSettings != null)
                {
                    m_importSettings.StartRef              = StartRef;
                    m_importSettings.EndRef                = EndRef;
                    m_importSettings.ImportTranslation     = chkTranslation.Checked;
                    m_importSettings.ImportBackTranslation = chkBackTranslation.Checked;
                    m_importSettings.ImportBookIntros      = chkBookIntros.Checked;
                    m_importSettings.ImportAnnotations     = chkOther.Checked;
                }
            }
        }