forked from restsharp/RestSharp
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding back Dispatcher handling for WP
new SL test projects
- Loading branch information
1 parent
29c9822
commit 6a1774c
Showing
15 changed files
with
565 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
RestSharp.Silverlight.Tests.Web/RestSharp.Silverlight.TestsTestPage.aspx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,74 @@ | |||
<%@ Page Language="C#" AutoEventWireup="true" %> | |||
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |||
<html xmlns="http://www.w3.org/1999/xhtml" > | |||
<head runat="server"> | |||
<title>RestSharp.Silverlight.Tests</title> | |||
<style type="text/css"> | |||
html, body { | |||
height: 100%; | |||
overflow: auto; | |||
} | |||
body { | |||
padding: 0; | |||
margin: 0; | |||
} | |||
#silverlightControlHost { | |||
height: 100%; | |||
text-align:center; | |||
} | |||
</style> | |||
<script type="text/javascript" src="Silverlight.js"></script> | |||
<script type="text/javascript"> | |||
function onSilverlightError(sender, args) { | |||
var appSource = ""; | |||
if (sender != null && sender != 0) { | |||
appSource = sender.getHost().Source; | |||
} | |||
var errorType = args.ErrorType; | |||
var iErrorCode = args.ErrorCode; | |||
if (errorType == "ImageError" || errorType == "MediaError") { | |||
return; | |||
} | |||
var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\n" ; | |||
errMsg += "Code: "+ iErrorCode + " \n"; | |||
errMsg += "Category: " + errorType + " \n"; | |||
errMsg += "Message: " + args.ErrorMessage + " \n"; | |||
if (errorType == "ParserError") { | |||
errMsg += "File: " + args.xamlFile + " \n"; | |||
errMsg += "Line: " + args.lineNumber + " \n"; | |||
errMsg += "Position: " + args.charPosition + " \n"; | |||
} | |||
else if (errorType == "RuntimeError") { | |||
if (args.lineNumber != 0) { | |||
errMsg += "Line: " + args.lineNumber + " \n"; | |||
errMsg += "Position: " + args.charPosition + " \n"; | |||
} | |||
errMsg += "MethodName: " + args.methodName + " \n"; | |||
} | |||
throw new Error(errMsg); | |||
} | |||
</script> | |||
</head> | |||
<body> | |||
<form id="form1" runat="server" style="height:100%"> | |||
<div id="silverlightControlHost"> | |||
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%"> | |||
<param name="source" value="ClientBin/RestSharp.Silverlight.Tests.xap"/> | |||
<param name="onError" value="onSilverlightError" /> | |||
<param name="background" value="white" /> | |||
<param name="minRuntimeVersion" value="4.0.50826.0" /> | |||
<param name="autoUpgrade" value="true" /> | |||
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none"> | |||
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/> | |||
</a> | |||
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div> | |||
</form> | |||
</body> | |||
</html> |
73 changes: 73 additions & 0 deletions
73
RestSharp.Silverlight.Tests.Web/RestSharp.Silverlight.TestsTestPage.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,73 @@ | |||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |||
<html xmlns="http://www.w3.org/1999/xhtml" > | |||
|
|||
<head> | |||
<title>RestSharp.Silverlight.Tests</title> | |||
<style type="text/css"> | |||
html, body { | |||
height: 100%; | |||
overflow: auto; | |||
} | |||
body { | |||
padding: 0; | |||
margin: 0; | |||
} | |||
#silverlightControlHost { | |||
height: 100%; | |||
text-align:center; | |||
} | |||
</style> | |||
<script type="text/javascript" src="Silverlight.js"></script> | |||
<script type="text/javascript"> | |||
function onSilverlightError(sender, args) { | |||
var appSource = ""; | |||
if (sender != null && sender != 0) { | |||
appSource = sender.getHost().Source; | |||
} | |||
|
|||
var errorType = args.ErrorType; | |||
var iErrorCode = args.ErrorCode; | |||
|
|||
if (errorType == "ImageError" || errorType == "MediaError") { | |||
return; | |||
} | |||
|
|||
var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\n" ; | |||
|
|||
errMsg += "Code: "+ iErrorCode + " \n"; | |||
errMsg += "Category: " + errorType + " \n"; | |||
errMsg += "Message: " + args.ErrorMessage + " \n"; | |||
|
|||
if (errorType == "ParserError") { | |||
errMsg += "File: " + args.xamlFile + " \n"; | |||
errMsg += "Line: " + args.lineNumber + " \n"; | |||
errMsg += "Position: " + args.charPosition + " \n"; | |||
} | |||
else if (errorType == "RuntimeError") { | |||
if (args.lineNumber != 0) { | |||
errMsg += "Line: " + args.lineNumber + " \n"; | |||
errMsg += "Position: " + args.charPosition + " \n"; | |||
} | |||
errMsg += "MethodName: " + args.methodName + " \n"; | |||
} | |||
|
|||
throw new Error(errMsg); | |||
} | |||
</script> | |||
</head> | |||
<body> | |||
<form id="form1" runat="server" style="height:100%"> | |||
<div id="silverlightControlHost"> | |||
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%"> | |||
<param name="source" value="ClientBin/RestSharp.Silverlight.Tests.xap"/> | |||
<param name="onError" value="onSilverlightError" /> | |||
<param name="background" value="white" /> | |||
<param name="minRuntimeVersion" value="4.0.50826.0" /> | |||
<param name="autoUpgrade" value="true" /> | |||
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none"> | |||
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/> | |||
</a> | |||
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div> | |||
</form> | |||
</body> | |||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0"?> | |||
<!-- | |||
For more information on how to configure your ASP.NET application, please visit | |||
http://go.microsoft.com/fwlink/?LinkId=169433 | |||
--> | |||
<configuration> | |||
<system.web> | |||
<compilation debug="true" targetFramework="4.0"/> | |||
</system.web> | |||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
x:Class="RestSharp.Silverlight.Tests.App" | |||
> | |||
<Application.Resources> | |||
|
|||
</Application.Resources> | |||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,58 @@ | |||
using System; | |||
using System.Windows; | |||
using Microsoft.Silverlight.Testing; | |||
|
|||
namespace RestSharp.Silverlight.Tests | |||
{ | |||
public partial class App : Application | |||
{ | |||
|
|||
public App() | |||
{ | |||
this.Startup += this.Application_Startup; | |||
this.Exit += this.Application_Exit; | |||
this.UnhandledException += this.Application_UnhandledException; | |||
|
|||
InitializeComponent(); | |||
} | |||
|
|||
private void Application_Startup(object sender, StartupEventArgs e) | |||
{ | |||
RootVisual = UnitTestSystem.CreateTestPage(); | |||
} | |||
|
|||
private void Application_Exit(object sender, EventArgs e) | |||
{ | |||
|
|||
} | |||
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) | |||
{ | |||
// If the app is running outside of the debugger then report the exception using | |||
// the browser's exception mechanism. On IE this will display it a yellow alert | |||
// icon in the status bar and Firefox will display a script error. | |||
if (!System.Diagnostics.Debugger.IsAttached) | |||
{ | |||
|
|||
// NOTE: This will allow the application to continue running after an exception has been thrown | |||
// but not handled. | |||
// For production applications this error handling should be replaced with something that will | |||
// report the error to the website and stop the application. | |||
e.Handled = true; | |||
Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); | |||
} | |||
} | |||
private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e) | |||
{ | |||
try | |||
{ | |||
string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace; | |||
errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n"); | |||
|
|||
System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");"); | |||
} | |||
catch (Exception) | |||
{ | |||
} | |||
} | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,7 @@ | |||
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
> | |||
<Deployment.Parts> | |||
</Deployment.Parts> | |||
|
|||
</Deployment> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,37 @@ | |||
// Copyright © Microsoft 2010 | |||
|
|||
using System.Reflection; | |||
using System.Runtime.CompilerServices; | |||
using System.Runtime.InteropServices; | |||
|
|||
// General Information about an assembly is controlled through the following | |||
// set of attributes. Change these attribute values to modify the information | |||
// associated with an assembly. | |||
[assembly: AssemblyTitle("RestSharp.Silverlight.Tests")] | |||
[assembly: AssemblyDescription("")] | |||
[assembly: AssemblyConfiguration("")] | |||
[assembly: AssemblyCompany("Microsoft")] | |||
[assembly: AssemblyProduct("RestSharp.Silverlight.Tests")] | |||
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] | |||
[assembly: AssemblyTrademark("")] | |||
[assembly: AssemblyCulture("")] | |||
|
|||
// Setting ComVisible to false makes the types in this assembly not visible | |||
// to COM components. If you need to access a type in this assembly from | |||
// COM, set the ComVisible attribute to true on that type. | |||
[assembly: ComVisible(false)] | |||
|
|||
// The following GUID is for the ID of the typelib if this project is exposed to COM | |||
[assembly: Guid("3cee7c40-9113-4121-bc38-c683df54c45f")] | |||
|
|||
// Version information for an assembly consists of the following four values: | |||
// | |||
// Major Version | |||
// Minor Version | |||
// Build Number | |||
// Revision | |||
// | |||
// You can specify all the values or you can default the Revision and Build Numbers | |||
// by using the '*' as shown below: | |||
[assembly: AssemblyVersion("1.0.0.0")] | |||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Oops, something went wrong.