public void StringPropIsMarked() { using (var view = new XmlView(m_hvoLexDb, "root", null, true, m_sda)) { var vc = new XmlVc(null, "root", true, view, null, m_sda); vc.IdentifySource = true; vc.SetCache(Cache); vc.m_layouts = m_layouts; vc.DataAccess = m_sda; var testEnv = new MockEnv() { DataAccess = m_sda, OpenObject = m_hvoLexDb }; vc.Display(testEnv, m_hvoLexDb, XmlVc.kRootFragId); VerifySourceIdentified(testEnv.EventHistory, m_hvoKick, kflidEntry_Form, m_wsVern, "Entry:basic:Headword:HeadwordL"); VerifyLabel(testEnv.EventHistory, m_hvoKick, kflidEntry_Form, m_wsVern, 1, ")", "Entry:basic:Headword:HeadwordL"); VerifyLabel(testEnv.EventHistory, m_hvoKick, kflidEntry_Form, m_wsVern, -2, "head(", "Entry:basic:Headword:HeadwordL"); VerifySourceIdentified(testEnv.EventHistory, m_hvoKick, kflidEntry_Summary, "Entry:basic:Summary:Sum."); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Exports the configured doc view. /// </summary> /// <param name="progressDlg">The progress dialog.</param> /// <param name="parameters">The parameters.</param> /// <returns>Always null.</returns> /// ------------------------------------------------------------------------------------ private object ExportConfiguredDocView(IAdvInd4 progressDlg, params object[] parameters) { Debug.Assert(parameters.Length == 3); m_progressDlg = progressDlg; if (m_xvc == null) { return(null); } string outPath = (string)parameters[0]; string fxtPath = (string)parameters[1]; FxtType ft = (FxtType)parameters[2]; try { m_cache.EnableBulkLoadingIfPossible(true); using (TextWriter w = new StreamWriter(outPath)) { FileInfo outFile = new FileInfo(outPath); #if DEBUG string dirPath = Path.GetTempPath(); int copyCount = 1; string s = string.Format("Starting Configured Export at {0}", System.DateTime.Now.ToLongTimeString()); Debug.WriteLine(s); #endif m_ce = new ConfiguredExport(null, m_cache.MainCacheAccessor, m_hvoRootObj); m_ce.Initialize(m_cache, w, ft.m_sDataType, ft.m_sFormat, outPath); m_ce.UpdateProgress += new SIL.FieldWorks.Common.Controls.ConfiguredExport.ProgressHandler(ce_UpdateProgress); m_xvc.Display(m_ce, m_hvoRootObj, m_seqView.RootFrag); m_ce.Finish(ft.m_sDataType); w.Close(); #if DEBUG s = string.Format("Finished Configured Export Dump at {0}", System.DateTime.Now.ToLongTimeString()); Debug.WriteLine(s); #endif if (ft.m_sXsltFiles != null && ft.m_sXsltFiles.Length != 0) { string[] rgsXslts = ft.m_sXsltFiles.Split(new char[] { ';' }); int cXslts = rgsXslts.GetLength(0); progressDlg.Position = 0; progressDlg.SetRange(0, cXslts); progressDlg.Message = xWorksStrings.ProcessingIntoFinalForm; int idx = fxtPath.LastIndexOfAny(new char[] { '/', '\\' }); if (idx < 0) { idx = 0; } else { ++idx; } string basePath = fxtPath.Substring(0, idx); for (int ix = 0; ix <= cXslts; ++ix) { #if DEBUG File.Copy(outPath, Path.Combine(dirPath, "DebugOnlyExportStage" + copyCount + ".txt"), true); copyCount++; if (ix < cXslts) { s = String.Format("Starting Configured Export XSLT file {0} at {1}", rgsXslts[ix], System.DateTime.Now.ToLongTimeString()); } else { s = String.Format("Starting final postprocess phase at {0}", System.DateTime.Now.ToLongTimeString()); } Debug.WriteLine(s); #endif if (ix < cXslts) { string sXsltPath = basePath + rgsXslts[ix]; m_ce.PostProcess(sXsltPath, outPath, ix + 1); } else { m_ce.PostProcess(null, outPath, ix + 1); } progressDlg.Step(0); } } if (ft.m_sFormat.ToLowerInvariant() == "xhtml") { IVwStylesheet vss = null; if (m_seqView.RootBox != null) { vss = m_seqView.RootBox.Stylesheet; } m_ce.WriteCssFile(Path.ChangeExtension(outPath, ".css"), vss); } m_ce = null; #if DEBUG File.Copy(outPath, Path.Combine(dirPath, "DebugOnlyExportStage" + copyCount + ".txt"), true); s = string.Format("Totally Finished Configured Export at {0}", System.DateTime.Now.ToLongTimeString()); Debug.WriteLine(s); #endif } } finally { m_cache.EnableBulkLoadingIfPossible(false); } return(null); }
public void StringPropIsMarked() { using (var view = new XmlView(m_hvoLexDb, "root", null, true, m_sda)) { var vc = new XmlVc(null, "root", true, view, null, m_sda); vc.IdentifySource = true; vc.SetCache(Cache); vc.m_layouts = m_layouts; vc.DataAccess = m_sda; var testEnv = new MockEnv() {DataAccess = m_sda, OpenObject = m_hvoLexDb}; vc.Display(testEnv, m_hvoLexDb, XmlVc.kRootFragId); VerifySourceIdentified(testEnv.EventHistory, m_hvoKick, kflidEntry_Form, m_wsVern, "Entry:basic:Headword:HeadwordL"); VerifyLabel(testEnv.EventHistory, m_hvoKick, kflidEntry_Form, m_wsVern, 1, ")", "Entry:basic:Headword:HeadwordL"); VerifyLabel(testEnv.EventHistory, m_hvoKick, kflidEntry_Form, m_wsVern, -3, "head(", "Entry:basic:Headword:HeadwordL"); VerifySourceIdentified(testEnv.EventHistory, m_hvoKick, kflidEntry_Summary, "Entry:basic:Summary:Sum."); } }