private void reloadPreview(object sender) { try { LMD_Document lmdDoc = new LMD_Document(MathBox.getDocument(mbox.Document)); pwindow.loadHTMLToPreview(lmdDoc.toHTML(LMD_Document.RenderingMode.LOCAL)); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void InitiatePreview() { if (PreviewIsOpen) { reloadPreview(null); return; } try { pwindow = new PreviewWindow(); pwindow.ReloadRequested += new ReloadRequestedHandler(reloadPreview); pwindow.Closed += new EventHandler(optimizator); LMD_Document lmdDoc = new LMD_Document(MathBox.getDocument(mbox.Document)); pwindow.loadHTMLToPreview(lmdDoc.toHTML(LMD_Document.RenderingMode.LOCAL)); pwindow.Show(); PreviewIsOpen = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }