本文整理汇总了C#中WebControl.Reload方法的典型用法代码示例。如果您正苦于以下问题:C# WebControl.Reload方法的具体用法?C# WebControl.Reload怎么用?C# WebControl.Reload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebControl
的用法示例。
在下文中一共展示了WebControl.Reload方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRenderable
/// <summary>
/// Create a new visual to render.
/// </summary>
/// <returns></returns>
private WebControl CreateRenderable()
{
// Get the web control.
var pControl = new WebControl();
// Create a web-session with our settings.
if (pWebSession == null)
{
pWebSession = WebCore.CreateWebSession(new WebPreferences()
{
EnableGPUAcceleration = Properties.Settings.Default.EnableGPUAcceleration,
Databases = Properties.Settings.Default.EnableWebDatabases,
WebGL = Properties.Settings.Default.EnableWebGL,
WebSecurity = Properties.Settings.Default.EnableWebSecurity,
FileAccessFromFileURL = Properties.Settings.Default.EnableWebFileAccessFromFileURL,
Plugins = true,
});
}
pControl.WebSession = pWebSession;
// Set the render dimensions.
pControl.Width = this.RenderResolution.X;
pControl.Height = this.RenderResolution.Y;
// Hide the surface while we load.
if (ActiveSurface != null)
ActiveSurface.ContentOpacity = 0.01;
// When the process has been createad, bind the global JS objects.
// http://awesomium.com/docs/1_7_rc3/sharp_api/html/M_Awesomium_Core_IWebView_CreateGlobalJavascriptObject.htm
pControl.ProcessCreated += (object sender, EventArgs e) =>
{
// CALLING window.Surface = {} in JS here has no effect.
// Bind all the Authority.request and Authority.call methods.
Log.Write("Display Process Created (1)", this.ToString(), Log.Type.AppError);
BindAPIFunctions(pControl);
};
UrlEventHandler p = null;
p = new UrlEventHandler((object senderOuter, UrlEventArgs eOuter) =>
{
// Unbind this handler.
pControl.DocumentReady -= p;
// Force a re-load so the $(document).ready will have access to our Authority.request etc.
pControl.Reload(false);
// CALLING window.Surface = {} in JS here has no effect.
//SignalSurfacePropertiesChanged();
Log.Write("Display DocReady (1)", this.ToString(), Log.Type.AppError);
// Bind the other events.
#region Events
// Handle navigating away from the URL in the load instruction.
pControl.AddressChanged += (object sender, UrlEventArgs e) =>
{
// Rebind the API methods?
Log.Write("Display has changed web address. " + e.Url, this.ToString(), Log.Type.DisplayInfo);
};
// Handle console messages.
pControl.TitleChanged += (object sender, TitleChangedEventArgs e) =>
{
this.Title = e.Title;
};
// Document ready.. do we beat JQuery?
pControl.DocumentReady += (object sender, UrlEventArgs e) =>
{
// Show the surface now we are loaded.
if (ActiveSurface != null)
ActiveSurface.ContentOpacity = 1.0;
// CALLING window.Surface = {} in JS here does not work quick enough.
Log.Write("Display DocReady (2)", this.ToString(), Log.Type.AppError);
SignalSurfacePropertiesChanged();
// EXPERIMENTAL - this sort of works.. depends on how the page detects touch events..
// SEE: Nice example: http://paulirish.com/demo/multi
// SEE: Nicer example: Bing maps!
// Try to inject multi-touch into the page.
if (ActiveSurface.AttemptMultiTouchInject)
{
pControl.ExecuteJavascript(Properties.Resources.MultiTouchInject);
}
};
// Handle changes in responsiveness.
pControl.ResponsiveChanged += (object sender, ResponsiveChangedEventArgs e) =>
{
// If it is not responsive, log the problem.
if (!e.IsResponsive)
{
//.........这里部分代码省略.........