mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-05 11:42:36 +00:00
added a binding test page to CefSharp.Example
This commit is contained in:
committed by
Dmitry Azaraev
parent
24983d67ab
commit
97b26909c5
Generated
+11
-1
@@ -45,6 +45,7 @@
|
||||
this.testRunArbitraryJavaScriptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.testSchemeHandlerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.testConsoleMessagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.testBingCLRObjectToJSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripContainer.TopToolStripPanel.SuspendLayout();
|
||||
this.toolStripContainer.SuspendLayout();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
@@ -165,7 +166,8 @@
|
||||
this.testRunJsSynchronouslyToolStripMenuItem,
|
||||
this.testRunArbitraryJavaScriptToolStripMenuItem,
|
||||
this.testSchemeHandlerToolStripMenuItem,
|
||||
this.testConsoleMessagesToolStripMenuItem});
|
||||
this.testConsoleMessagesToolStripMenuItem,
|
||||
this.testBingCLRObjectToJSToolStripMenuItem});
|
||||
this.testsToolStripMenuItem.Name = "testsToolStripMenuItem";
|
||||
this.testsToolStripMenuItem.Size = new System.Drawing.Size(46, 20);
|
||||
this.testsToolStripMenuItem.Text = "Tests";
|
||||
@@ -205,6 +207,13 @@
|
||||
this.testConsoleMessagesToolStripMenuItem.Text = "Test Console Messages";
|
||||
this.testConsoleMessagesToolStripMenuItem.Click += new System.EventHandler(this.TestConsoleMessagesToolStripMenuItemClick);
|
||||
//
|
||||
// testBingCLRObjectToJSToolStripMenuItem
|
||||
//
|
||||
this.testBingCLRObjectToJSToolStripMenuItem.Name = "testBingCLRObjectToJSToolStripMenuItem";
|
||||
this.testBingCLRObjectToJSToolStripMenuItem.Size = new System.Drawing.Size(224, 22);
|
||||
this.testBingCLRObjectToJSToolStripMenuItem.Text = "Test Bing CLR object to JS";
|
||||
this.testBingCLRObjectToJSToolStripMenuItem.Click += new System.EventHandler(this.TestBingClrObjectToJsToolStripMenuItemClick);
|
||||
//
|
||||
// Browser
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@@ -247,6 +256,7 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem testRunArbitraryJavaScriptToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem testSchemeHandlerToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem testConsoleMessagesToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem testBingCLRObjectToJSToolStripMenuItem;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -178,5 +178,10 @@ namespace CefSharp.Example
|
||||
{
|
||||
MessageBox.Show(e.Source + ":" + e.Line + " " + e.Message, "JavaScript console message");
|
||||
}
|
||||
|
||||
private void TestBingClrObjectToJsToolStripMenuItemClick(object sender, EventArgs e)
|
||||
{
|
||||
_browserControl.Load("test://test/BindingTest.html");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
<None Include="Resources\chromium-256.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\BindingTest.html" />
|
||||
<Content Include="Resources\SchemeTest.html" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
+28
@@ -60,6 +60,34 @@ namespace CefSharp.Example.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
///<html>
|
||||
/// <head>
|
||||
/// <title></title>
|
||||
/// </head>
|
||||
/// <body>
|
||||
/// <p>
|
||||
/// Result of calling bound.Repeat("hi ", 5) =
|
||||
/// <script type="text/javascript">
|
||||
/// var result = bound.Repeat("hi ", 5);
|
||||
/// document.write('"' + result + '"');
|
||||
/// if(result == "hi hi hi hi hi ")
|
||||
/// {
|
||||
/// document.write(" SUCCESS");
|
||||
/// }
|
||||
/// else
|
||||
/// {
|
||||
/// document.write(" FAIL!");
|
||||
/// }
|
||||
/// [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string BindingTest {
|
||||
get {
|
||||
return ResourceManager.GetString("BindingTest", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Bitmap chromium256 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("chromium256", resourceCulture);
|
||||
|
||||
@@ -136,4 +136,7 @@
|
||||
<data name="SchemeTest" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\SchemeTest.html;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
<data name="BindingTest" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\BindingTest.html;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Binding Test</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
Result of calling bound.Repeat("hi ", 5) =
|
||||
<script type="text/javascript">
|
||||
var result = bound.Repeat("hi ", 5);
|
||||
document.write('"' + result + '"');
|
||||
if(result == "hi hi hi hi hi ")
|
||||
{
|
||||
document.write(" SUCCESS");
|
||||
}
|
||||
else
|
||||
{
|
||||
document.write(" FAIL!");
|
||||
}
|
||||
</script>
|
||||
</p>
|
||||
|
||||
Methods on bound object 'bound':<br />
|
||||
<ul>
|
||||
<script type="text/javascript">
|
||||
for(var name in bound) {
|
||||
document.write("<li>" + name + "</li>");
|
||||
}
|
||||
</script>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -17,6 +17,15 @@ namespace CefSharp.Example
|
||||
mimeType = "text/html";
|
||||
return true;
|
||||
}
|
||||
|
||||
if (request.Url.EndsWith("BindingTest.html", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(Resources.BindingTest);
|
||||
stream = new MemoryStream(bytes);
|
||||
mimeType = "text/html";
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user