Skip to content

Commit

Permalink
add quick winforms tooltip test html file
Browse files Browse the repository at this point in the history
  • Loading branch information
ataranto committed Jun 10, 2011
1 parent 9bf2690 commit 4c71c08
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 16 deletions.
20 changes: 15 additions & 5 deletions 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 @@ -200,6 +200,11 @@ private void cefSharpHomeToolStripMenuItem_Click(object sender, EventArgs e)
private void fireBugLiteToolStripMenuItem_Click(object sender, EventArgs e)
{
_browserControl.Load("http://getfirebug.com/firebuglite");
}

private void testTooltipsToolStripMenuItem_Click(object sender, EventArgs e)
{
_browserControl.Load("test://test/TooltipTest.html");
}
}
}
1 change: 1 addition & 0 deletions CefSharp.Example/CefSharp.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
<ItemGroup>
<Content Include="Resources\BindingTest.html" />
<Content Include="Resources\SchemeTest.html" />
<Content Include="Resources\TooltipTest.html" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
28 changes: 24 additions & 4 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 @@ -139,4 +139,7 @@
<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>
<data name="TooltipTest" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\TooltipTest.html;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
</root>
13 changes: 13 additions & 0 deletions CefSharp.Example/Resources/TooltipTest.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Scheme Handler Test</title>
</head>
<body>
<form>
<input type="text" size=25 title="This is the first tooltip">
<input type="text" size=25 title="This is the second tooltip">
<input type="button" value="Submit">
</form>
</body>
</html>
21 changes: 14 additions & 7 deletions CefSharp.Example/TestSchemeHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,24 @@ public class TestSchemeHandler : ISchemeHandler
{
public bool ProcessRequest(IRequest request, ref string mimeType, ref Stream stream)
{
if(request.Url.EndsWith("SchemeTest.html", StringComparison.OrdinalIgnoreCase))
string resource = null;

if (request.Url.EndsWith("SchemeTest.html", StringComparison.OrdinalIgnoreCase))
{
byte[] bytes = Encoding.UTF8.GetBytes(Resources.SchemeTest);
stream = new MemoryStream(bytes);
mimeType = "text/html";
return true;
resource = Resources.SchemeTest;
}
else if (request.Url.EndsWith("BindingTest.html", StringComparison.OrdinalIgnoreCase))
{
resource = Resources.BindingTest;
}
else if (request.Url.EndsWith("TooltipTest.html", StringComparison.OrdinalIgnoreCase))
{
resource = Resources.TooltipTest;
}

if (request.Url.EndsWith("BindingTest.html", StringComparison.OrdinalIgnoreCase))
if (!String.IsNullOrEmpty(resource))
{
byte[] bytes = Encoding.UTF8.GetBytes(Resources.BindingTest);
byte[] bytes = Encoding.UTF8.GetBytes(resource);
stream = new MemoryStream(bytes);
mimeType = "text/html";
return true;
Expand Down

0 comments on commit 4c71c08

Please sign in to comment.