/// <summary>
 /// Intended to be used to set the singleton HomographConfiguration in FLEx to the settings from this model
 /// </summary>
 public void ExportToHomographConfiguration(HomographConfiguration config)
 {
     config.HomographNumberBefore   = HomographNumberBefore;
     config.ShowSenseNumberRef      = ShowSenseNumber;
     config.ShowSenseNumberReversal = ShowSenseNumberReversal;
     config.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.Main, ShowHwNumber);
     config.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef, ShowHwNumInCrossRef);
     config.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef, ShowHwNumInReversalCrossRef);
     config.WritingSystem          = HomographWritingSystem;
     config.CustomHomographNumbers = CustomHomographNumberList;
 }
 /// <summary>
 /// Set the properties of the HC passed in to those indicated by the dialog.
 /// </summary>
 public void GetResults(HomographConfiguration hc)
 {
     hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.Main, !m_radioHide.Checked);
     hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef,
                               !m_radioHide.Checked && m_chkShowHomographNumInDict.Checked);
     hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef,
                               !m_radioHide.Checked && m_chkShowHomographNumInReversal.Checked);
     hc.HomographNumberBefore   = m_radioBefore.Checked;
     hc.ShowSenseNumberRef      = !m_radioHide.Checked && m_chkShowSenseNumInDict.Checked;
     hc.ShowSenseNumberReversal = !m_radioHide.Checked && m_chkShowSenseNumInReversal.Checked;
 }
 /// <summary>
 /// Set the properties of the HomographConfiguration to those specified in the dialog.
 /// </summary>
 protected override void OnClosing(CancelEventArgs e)
 {
     if (DialogResult == DialogResult.OK)
     {
         m_homographConfiguration.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.Main, !m_radioHide.Checked);
         m_homographConfiguration.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef,
                                                         !m_radioHide.Checked && m_chkShowHomographNumInReversal.Checked);
         m_homographConfiguration.HomographNumberBefore   = m_radioBefore.Checked;
         m_homographConfiguration.ShowSenseNumberReversal = !m_radioHide.Checked && m_chkShowSenseNumInReversal.Checked;
     }
     base.OnClosing(e);
     if (m_masterRefreshRequired)
     {
         DialogResult = DialogResult.OK;                 // let the client know that something has changed
     }
 }
        public void PersistData()
        {
            var hc = new HomographConfiguration();

            Assert.That(hc.PersistData, Is.EqualTo(""));
            hc.HomographNumberBefore = true;
            hc.ShowSenseNumberRef    = false;
            Assert.That(hc.PersistData, Is.EqualTo("before snRef "));
            var hc2 = new HomographConfiguration();

            hc2.PersistData = hc.PersistData;
            Assert.That(hc2.ShowSenseNumberRef, Is.False);
            Assert.That(hc2.HomographNumberBefore, Is.True);
            Assert.That(hc2.ShowSenseNumberReversal, Is.True);

            hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.Main, false);
            hc2.PersistData = hc.PersistData;
            Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.Main), Is.False);
            Assert.That(hc2.HomographNumberBefore, Is.False);

            hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.Main, true);
            hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef, false);
            hc2.PersistData = hc.PersistData;
            Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.Main), Is.True);
            Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef), Is.False);
            Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef), Is.True);

            hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef, false);
            hc2.PersistData = hc.PersistData;
            Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.Main), Is.True);
            Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef), Is.False);
            Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef), Is.False);

            hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef, true);
            hc2.PersistData = hc.PersistData;
            Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.Main), Is.True);
            Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef), Is.True);
            Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef), Is.False);

            hc.ShowSenseNumberRef      = true;
            hc.ShowSenseNumberReversal = false;
            hc2.PersistData            = hc.PersistData;
            Assert.That(hc2.ShowSenseNumberRef, Is.True);
            Assert.That(hc2.ShowSenseNumberReversal, Is.False);
        }