private void LoadHtml(string fileName) { _richTextBox.Visible = false; Core.WebBrowser.Visible = true; Core.WebBrowser.ShowHtml("<html><body style=\"font-family: Tahoma; font-size: 8pt; text-align: center; margin-top: 14pt;\">Please wait while the document is being converted…</body></html>", WebSecurityContext.Restricted, null); _killedConverter = false; _converterProcess = WordDocPlugin.CreateWvWareProcess(fileName, "wvHtml.xml", false); _converterProcess.EnableRaisingEvents = true; _converterProcess.Exited += _converterProcess_OnExited; try { if (!_converterProcess.Start()) { throw new Exception(); } } catch { _converterProcess = null; Core.UIManager.QueueUIJob(new ShowErrorDelegate(ShowError), "WVWare conversion failed. Could not start convertion process: converter not found."); return; } _convertedFileName = Path.Combine(WordDocPlugin.TempDir, Path.GetFileNameWithoutExtension(fileName) + ".html"); _converterOutputReader = new StreamReader(_converterProcess.StandardOutput.BaseStream, Encoding.UTF8); _converterOutputWriter = new StreamWriter(_convertedFileName, false, Encoding.UTF8); new Thread(ProcessConverterOutput).Start(); }
public void DisplayResource(IResource resource) { _wordsToHighlight = null; _resource = resource; // If we got a sign that the resource's file was not parsed string errorBody = resource.GetPropText(Core.Props.LastError); if (!String.IsNullOrEmpty(errorBody)) { ShowError(errorBody); } else { try { _sourceFileName = Core.FileResourceManager.GetSourceFile(resource); if (WordDocPlugin.IsRtfFile(_sourceFileName)) { LoadRtf(_sourceFileName); Core.FileResourceManager.CleanupSourceFile(resource, _sourceFileName); } else { LoadHtml(_sourceFileName); } } catch (Exception ex) { ShowError("Failed to open " + _sourceFileName + ". " + ex.Message); } } }