public override void EditResource(IResource fragment) { _fragment = fragment; _linkedFlag = _fragment.GetLinkProp("Flag"); if (!_isLoaded) // The Web browser has not been created yet, wait for the OnLoad event { return; } _edtName.Text = fragment.GetStringProp(Core.Props.Subject); _edtAnnotation.Text = fragment.GetPropText(Core.Props.Annotation); if (fragment.HasProp(Core.Props.LongBodyIsRTF)) { _richTextBox.Rtf = fragment.GetPropText(Core.Props.LongBody); _browser.Visible = false; } else { _browser.ShowHtml(fragment.GetPropText(Core.Props.LongBody), _ctxDisplayClipping, null); _richTextBox.Visible = false; } _chkOpenAfterSave.Checked = Core.SettingStore.ReadBool("Clippings", "OpenAfterSave", true); if (!_fragment.IsTransient) { _openOptionsPanel.Visible = false; } _selector.Resource = fragment; }
/** * This method is called by IEBrowserDisplayPane to display the specified resource * in the browser. */ private void DisplayConversation(IResource resource, AbstractWebBrowser browser, WordPtr[] wordsToHighlight) { // Ask ConversationManager to format the conversation as HTML and // feed it into IEBrowser. string htmlString = _convManager.ToHtmlString(resource, _propNick); browser.ShowHtml(htmlString, WebSecurityContext.Restricted, DocumentSection.RestrictResults(wordsToHighlight, DocumentSection.BodySection)); }
private static void DisplayHTML(IResource resource, AbstractWebBrowser browser, WordPtr[] wordsToHighlight) { try { StreamReader reader = Core.FileResourceManager.GetStreamReader(resource); if (reader != null) { string sourceUrl = ""; string htmlText = Utils.StreamReaderReadToEnd(reader); reader.BaseStream.Close(); IResource source = FileResourceManager.GetSource(resource); if (source != null) { string url = string.Empty; if (Core.ResourceStore.PropTypes.Exist("URL")) { url = source.GetPropText("URL"); } if (url.Length > 0) { sourceUrl = url; htmlText = HtmlTools.FixRelativeLinks(htmlText, url); } else { string directory = source.GetPropText("Directory"); if (directory.Length > 0) { if ((!directory.EndsWith("/")) && (!directory.EndsWith("\\"))) { directory += "/"; } htmlText = HtmlTools.FixRelativeLinks(htmlText, directory); } } } try { WebSecurityContext context = WebSecurityContext.Restricted; context.WorkOffline = false; browser.ShowHtml(htmlText, context, DocumentSection.RestrictResults(wordsToHighlight, DocumentSection.BodySection)); browser.CurrentUrl = sourceUrl; } catch (Exception e) { Trace.WriteLine(e.ToString(), "Html.Plugin"); } } } catch (ObjectDisposedException) {} }
/** * displays conversation as auto-generated html text */ private void DisplayConversation(IResource resource, AbstractWebBrowser browser, WordPtr[] wordsToHighlight) { try { browser.ShowHtml(_conversationManager.ToHtmlString(resource, _propNickName), WebSecurityContext.Restricted, DocumentSection.RestrictResults(wordsToHighlight, DocumentSection.BodySection)); } catch (Exception e) { Trace.WriteLine(e.ToString(), "ICQ.Plugin"); return; } _displayedResource = resource.ToResourceListLive(); _displayedResource.ResourceChanged += ConversationChangedHandler; }
/// <summary> /// Method shows html-formatted text in the browser. Offsets for highlighting are /// restricted to the <see cref="DocumentSection.BodySection">BodySection</see> section. /// </summary> protected void ShowHtml(string html, WebSecurityContext securityContext, WordPtr[] toHighlight) { AttachWebBrowser(); WordPtr[] restrictedWords = DocumentSection.RestrictResults(toHighlight, DocumentSection.BodySection); _ieBrowser.ShowHtml(html, securityContext, restrictedWords); // Use the updated offsets }