public bool OnExport(object argument) { CheckDisposed(); using (var dlg = new ExportDialog(m_mediator)) { dlg.ShowDialog(); } return(true); // handled }
public bool OnExport(object argument) { CheckDisposed(); using (var dlg = new ExportDialog(m_mediator)) { dlg.ShowDialog(); } return true; // handled }
public bool OnExport(object argument) { CheckDisposed(); string areaChoice = m_mediator.PropertyTable.GetStringProperty("areaChoice", null); if (areaChoice == "notebook") { if (AreCustomFieldsAProblem(new int[] { RnGenericRecTags.kClassId})) return true; using (var dlg = new NotebookExportDialog(m_mediator)) { dlg.ShowDialog(); } } else { // It's somewhat unfortunate that this bit of code knows what classes can have custom fields. // However, we put in code to prevent punctuation in custom field names at the same time as this check (which is therefore // for the benefit of older projects), so it should not be necessary to check any additional classes we allow to have them. if (AreCustomFieldsAProblem(new int[] { LexEntryTags.kClassId, LexSenseTags.kClassId, LexExampleSentenceTags.kClassId, MoFormTags.kClassId })) return true; using (var dlg = new ExportDialog(m_mediator)) { dlg.ShowDialog(); } this.ActivateUI(true); } return true; // handled }
public void ExportSemanticDomains() { using (var exportDlg = new ExportDialog()) { exportDlg.SetCache(m_cache); var tempPath = Path.GetTempFileName(); var fxt = new ExportDialog.FxtType(); fxt.m_sXsltFiles = "SemDomQs.xsl"; var fxtPath = Path.Combine(exportDlg.FxtDirectory, "SemDomQs.xml"); var wss = new List<int>(); wss.Add(m_cache.LanguageWritingSystemFactoryAccessor.GetWsFromStr("en")); exportDlg.SetTranslationWritingSystems(wss); exportDlg.ExportSemanticDomains(new DummyProgressDlg(), new object[] {tempPath, fxt, fxtPath, false}); string result; using (var reader = new StreamReader(tempPath, Encoding.UTF8)) result = reader.ReadToEnd(); File.Delete(tempPath); Assert.That(result, Is.StringContaining("What words refer to the sun?")); Assert.That(result, Is.Not.StringContaining("1.1.1.11.1.1.1"), "should not output double abbr for en"); Assert.That(result, Is.Not.StringContaining("class: english"), "English should not give anything the missing translation style"); wss.Clear(); wss.Add(m_cache.LanguageWritingSystemFactoryAccessor.GetWsFromStr("fr")); exportDlg.ExportSemanticDomains(new DummyProgressDlg(), new object[] {tempPath, fxt, fxtPath, false}); using (var reader = new StreamReader(tempPath, Encoding.UTF8)) result = reader.ReadToEnd(); File.Delete(tempPath); Assert.That(result, Is.Not.StringContaining("What words refer to the sun?"), "french export should not have english questions"); Assert.That(result, Is.StringContaining("<p class=\"quest1\" lang=\"fr\">(1) Quels mots se"), "French export should have the French question (not english class)"); exportDlg.ExportSemanticDomains(new DummyProgressDlg(), new object[] {tempPath, fxt, fxtPath, true}); using (var reader = new StreamReader(tempPath, Encoding.UTF8)) result = reader.ReadToEnd(); File.Delete(tempPath); Assert.That(result, Is.StringContaining("<span class=\"english\" lang=\"en\">(1) What words refer to the sun?"), "french export with all questions should have english where french is missing (in red)"); Assert.That(result, Is.StringContaining("<p class=\"quest1\" lang=\"fr\">(1) Quels mots se"), "French export should have the French question (not red)"); Assert.That(result, Is.Not.StringContaining("What words refer to everything we can see"), "French export should not have English alternative where French is present"); } }