public virtual void Redraw() { string text = editorPane.GetText(); taggedContents = null; untaggedContents = null; if (!editorPane.GetContentType().Equals("text/html")) { editorPane.SetContentType("text/rtf"); IDocument doc = editorPane.GetDocument(); try { doc.InsertString(0, text, defaultAttrSet); } catch (Exception e) { throw new Exception(e); } editorPane.Revalidate(); editorPane.Repaint(); editorPane.SetEditable(true); htmlContents = null; } else { editorPane.SetEditable(false); htmlContents = editorPane.GetText(); } saveUntagged.SetEnabled(false); saveTaggedAs.SetEnabled(false); }
private void OpenURL(string url) { try { editorPane.SetPage(url); } catch (Exception e) { log.Info("Error loading |" + url + '|'); log.Warn(e); DisplayError("Error Loading URL " + url, "Message: " + e); return; } loadedFile = null; string text = editorPane.GetText(); taggedContents = null; if (!editorPane.GetContentType().Equals("text/html")) { editorPane.SetContentType("text/rtf"); IDocument doc = editorPane.GetDocument(); try { doc.InsertString(0, text, defaultAttrSet); } catch (Exception e) { throw new Exception(e); } editorPane.Revalidate(); editorPane.Repaint(); editorPane.SetEditable(true); htmlContents = null; } else { editorPane.SetEditable(false); htmlContents = editorPane.GetText(); } saveUntagged.SetEnabled(false); saveTaggedAs.SetEnabled(false); }