Skip to content

Commit

Permalink
added a binding test page to CefSharp.Example
Browse files Browse the repository at this point in the history
  • Loading branch information
chillitom authored and Dmitry Azaraev committed Dec 14, 2010
1 parent 24983d6 commit 97b2690
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 1 deletion.
12 changes: 11 additions & 1 deletion CefSharp.Example/Browser.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions CefSharp.Example/Browser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,10 @@ private void HandleConsoleMessage(object sender, ConsoleMessageEventArgs e)
{
MessageBox.Show(e.Source + ":" + e.Line + " " + e.Message, "JavaScript console message");
}

private void TestBingClrObjectToJsToolStripMenuItemClick(object sender, EventArgs e)
{
_browserControl.Load("test://test/BindingTest.html");
}
}
}
1 change: 1 addition & 0 deletions CefSharp.Example/CefSharp.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
28 changes: 28 additions & 0 deletions CefSharp.Example/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions CefSharp.Example/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
32 changes: 32 additions & 0 deletions CefSharp.Example/Resources/BindingTest.html
Original file line number Diff line number Diff line change
@@ -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>
9 changes: 9 additions & 0 deletions CefSharp.Example/TestSchemeHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ public bool ProcessRequest(IRequest request, ref string mimeType, ref Stream str
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;
}
}
Expand Down

0 comments on commit 97b2690

Please sign in to comment.