本文整理汇总了C#中WebView.LoadFile方法的典型用法代码示例。如果您正苦于以下问题:C# WebView.LoadFile方法的具体用法?C# WebView.LoadFile怎么用?C# WebView.LoadFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebView
的用法示例。
在下文中一共展示了WebView.LoadFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public virtual void Load(int width, int height)
{
Width = width;
Height = height;
_page = new Texture();
GUIShader = Assets.Fetch<ShaderProgram>("GUI");
GUIShader.AddUniform("scale");
VBO = new VBO<VertexPositionNormalTexture>();
VAO = new VAO<VertexPositionNormalTexture>();
VBO.Buffer(new[]{
new VertexPositionNormalTexture{Position = new Vector3(0, Height, 0f),Normal = Vector3.UnitZ,TexCoord = new Vector2(0, Height)},
new VertexPositionNormalTexture{Position = new Vector3(Width, Height, 0f),Normal = Vector3.UnitZ,TexCoord = new Vector2(Width, Height)},
new VertexPositionNormalTexture{Position = new Vector3(Width, 0, 0f),Normal = Vector3.UnitZ,TexCoord = new Vector2(Width, 0)},
new VertexPositionNormalTexture{Position = new Vector3(0, 0, 0),Normal = Vector3.UnitZ,TexCoord = new Vector2(0,0)}
});
VAO.Setup(GUIShader, VBO);
_webView = WebCore.CreateWebView(Width, Height);
WebCore.BaseDirectory = Path.Combine(Directory.GetCurrentDirectory(), "GUI");
_webView.FlushAlpha = false;
_webView.IsTransparent = true;
_webView.CreateObject("console");
_webView.SetObjectCallback("console", "log", (sender, e) => Bus.Add(new DebugMessage(Timer.LastTickTime, e.Arguments[0].ToString())));
_webView.CreateObject("GUI");
_webView.CreateObject("Bus");
_webView.LoadFile("index.htm");
}
示例2: Initialize
/// <summary>
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
public override void Initialize()
{
webView = WebCore.CreateWebView(WindowSize.Width, WindowSize.Height);
webView.LoadCompleted += OnFinishLoading;
WebCore.BaseDirectory = Environment.CurrentDirectory;
string path = @"\test.htm";
if (!webView.LoadFile(path))
{
throw new ApplicationException("Error loading html file.");
}
base.Initialize();
}