本文整理汇总了C#中WebBrowser.NavigateToString方法的典型用法代码示例。如果您正苦于以下问题:C# WebBrowser.NavigateToString方法的具体用法?C# WebBrowser.NavigateToString怎么用?C# WebBrowser.NavigateToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebBrowser
的用法示例。
在下文中一共展示了WebBrowser.NavigateToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChannelAPI
// CONSTRUCTOR
public ChannelAPI(CollabrifyClient c, LoadCompletedEventHandler del = null)
{
Debug.WriteLine(LOG_TAG + ": building ChannelAPI.");
mChannelClosed = true;
client = c;
// Builds the browser object
try
{
browser = new WebBrowser();
browser.IsScriptEnabled = true;
browser.ScriptNotify += ScriptCallback;
browser.LoadCompleted += delegate { };
if(del != null) browser.LoadCompleted += del;
}
catch( Exception ex)
{
Debug.WriteLine(LOG_TAG + ": " + ex.Source);
Debug.WriteLine("\t" + ex.Message);
}
string html = null;
using (var s = Assembly.GetExecutingAssembly().GetManifestResourceStream("Collabrify_wp8.Resources.home.html"))
using (var r = new StreamReader(s))
html = r.ReadToEnd();
browser.NavigateToString(html);
}
示例2: SetHtml
private void SetHtml(string html, WebBrowser browser)
{
string fontColor = FetchFontColor();
string backgroundColor = FetchBackgroundColor();
SetBackground(browser);
var htmlScript = "<script>function getDocHeight() { " +
"return document.getElementById('pageWrapper').offsetHeight;" +
"}" +
"function SendDataToPhoneApp() {" +
"window.external.Notify('' + getDocHeight());" +
"}</script>";
var htmlConcat = string.Format("<html><head>{0}</head>" +
"<body style=\"margin:0px;padding:0px;background-color:{3};\" " +
"onLoad=\"SendDataToPhoneApp()\">" +
"<div id=\"pageWrapper\" style=\"width:100%; color:{2}; " +
"background-color:{3}\">{1}</div></body></html>",
htmlScript,
html,
fontColor,
backgroundColor);
browser.NavigateToString(htmlConcat);
browser.IsScriptEnabled = true;
//Browser.ScriptNotify +=
// new EventHandler<NotifyEventArgs>(wb1_ScriptNotify);
}