Upgraded to Silverlight 3 RTW (3.0.40624.0).

--HG--
extra : convert_revision : svn%3Affd33b8c-2492-42e0-bdc5-587b920b7d6d/trunk%4023879
This commit is contained in:
Sean Fausett 2009-07-11 07:11:41 +00:00
parent 7522f7cd15
commit e95423c606
7 changed files with 28 additions and 188 deletions

View File

@ -1,77 +0,0 @@
<!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" >
<!-- saved from url=(0014)about:internet -->
<head>
<title>Jellyfish.Virtu</title>
<style type="text/css">
html, body {
height: 100%;
overflow: auto;
}
body {
padding: 0;
margin: 0;
}
#silverlightControlHost {
height: 100%;
}
</style>
<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;
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>
<!-- Runtime errors from Silverlight will be displayed here.
This will contain debugging information and should be removed or hidden when debugging is completed -->
<div id='errorLocation' style="font-size: small;color: Gray;"></div>
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%" style="position:absolute;top:0px;left:0px;right:0px;bottom:0px;">
<param name="source" value="bin/Jellyfish.Virtu.xap"/>
<param name="onerror" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="3.0.40307.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=141205" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
</a>
</object>
<iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>
</div>
</body>
</html>

View File

@ -26,6 +26,8 @@
<SignAssembly>false</SignAssembly> <SignAssembly>false</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\Jellyfish.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>..\..\Jellyfish.snk</AssemblyOriginatorKeyFile>
<UsePlatformExtensions>false</UsePlatformExtensions> <UsePlatformExtensions>false</UsePlatformExtensions>
<EnableOutOfBrowser>true</EnableOutOfBrowser>
<OutOfBrowserSettingsFile>Properties\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -195,12 +197,7 @@
</CodeAnalysisDictionary> </CodeAnalysisDictionary>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Jellyfish.Virtu.html"> <None Include="Properties\OutOfBrowserSettings.xml" />
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Jellyfish.Virtu.Debug.html" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" Condition="" /> <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" Condition="" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -1,77 +0,0 @@
<!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" >
<!-- saved from url=(0014)about:internet -->
<head>
<title>Jellyfish.Virtu</title>
<style type="text/css">
html, body {
height: 100%;
overflow: auto;
}
body {
padding: 0;
margin: 0;
}
#silverlightControlHost {
height: 100%;
}
</style>
<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;
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>
<!-- Runtime errors from Silverlight will be displayed here.
This will contain debugging information and should be removed or hidden when debugging is completed -->
<div id='errorLocation' style="font-size: small;color: Gray;"></div>
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%" style="position:absolute;top:0px;left:0px;right:0px;bottom:0px;">
<param name="source" value="Jellyfish.Virtu.xap"/>
<param name="onerror" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="3.0.40307.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=141205" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
</a>
</object>
<iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>
</div>
</body>
</html>

View File

@ -1,13 +1,5 @@
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" <Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Deployment.ApplicationIdentity> <Deployment.Parts>
<ApplicationIdentity ShortName="Virtu" Title="Virtu" Blurb="Apple IIe Emulator"> </Deployment.Parts>
<!--<ApplicationIdentity.Icons>
<Icon Size="16x16">Properties/Apple16.png</Icon>
<Icon Size="32x32">Properties/Apple32.png</Icon>
<Icon Size="48x48">Properties/Apple48.png</Icon>
<Icon Size="128x128">Properties/Apple128.png</Icon>
</ApplicationIdentity.Icons>-->
</ApplicationIdentity>
</Deployment.ApplicationIdentity>
</Deployment> </Deployment>

View File

@ -0,0 +1,7 @@
<OutOfBrowserSettings ShortName="Virtu" EnableGPUAcceleration="false" ShowInstallMenuItem="true">
<OutOfBrowserSettings.Blurb>Apple IIe Emulator</OutOfBrowserSettings.Blurb>
<OutOfBrowserSettings.WindowSettings>
<WindowSettings Title="Virtu" Width="560" Height="384"/>
</OutOfBrowserSettings.WindowSettings>
<OutOfBrowserSettings.Icons/>
</OutOfBrowserSettings>

View File

@ -233,12 +233,9 @@ private int GetAsciiKey(Key key, int platformKeyCode)
return control ? 0x1A : capsLock ? 'Z' : 'z'; return control ? 0x1A : capsLock ? 'Z' : 'z';
case Key.Unknown: case Key.Unknown:
if (Application.Current.RunningOffline) switch (Environment.OSVersion.Platform)
{
// SL cannot access HtmlPage.BrowserInformation.Platform when out of browser
}
else if (HtmlPage.BrowserInformation.Platform.Equals("Win32", StringComparison.OrdinalIgnoreCase))
{ {
case PlatformID.Win32NT:
switch (platformKeyCode) switch (platformKeyCode)
{ {
case 0xBA: // WinForms Keys.Oem1 case 0xBA: // WinForms Keys.Oem1
@ -274,9 +271,9 @@ private int GetAsciiKey(Key key, int platformKeyCode)
case 0xBE: // WinForms Keys.OemPeriod case 0xBE: // WinForms Keys.OemPeriod
return shift ? '>' : '.'; return shift ? '>' : '.';
} }
} break;
else if (HtmlPage.BrowserInformation.Platform.Equals("MacIntel", StringComparison.OrdinalIgnoreCase))
{ case PlatformID.MacOSX:
switch (platformKeyCode) switch (platformKeyCode)
{ {
case 0x29: case 0x29:
@ -312,6 +309,10 @@ private int GetAsciiKey(Key key, int platformKeyCode)
case 0x2F: case 0x2F:
return shift ? '>' : '.'; return shift ? '>' : '.';
} }
break;
case PlatformID.Unix: // TODO
break;
} }
break; break;

View File

@ -15,8 +15,9 @@ public SilverlightVideoService(Image image)
_image = image; _image = image;
SetImageSize(); SetImageSize();
_bitmap = new WriteableBitmap(BitmapWidth, BitmapHeight, BitmapPixelFormat); _bitmap = new WriteableBitmap(BitmapWidth, BitmapHeight);
_pixels = new uint[BitmapWidth * BitmapHeight]; _pixels = new int[BitmapWidth * BitmapHeight];
_image.Source = _bitmap;
Application.Current.Host.Content.Resized += (sender, e) => SetImageSize(); Application.Current.Host.Content.Resized += (sender, e) => SetImageSize();
} }
@ -24,13 +25,13 @@ public SilverlightVideoService(Image image)
[SuppressMessage("Microsoft.Usage", "CA2233:OperationsShouldNotOverflow", MessageId = "y*560")] [SuppressMessage("Microsoft.Usage", "CA2233:OperationsShouldNotOverflow", MessageId = "y*560")]
public override void SetPixel(int x, int y, uint color) public override void SetPixel(int x, int y, uint color)
{ {
_pixels[y * BitmapWidth + x] = color; _pixels[y * BitmapWidth + x] = (int)color;
_pixelsDirty = true; _pixelsDirty = true;
} }
public override void Update() public override void Update()
{ {
if (Application.Current.RunningOffline && /*_window.IsActive &&*/ (_isFullScreen != IsFullScreen)) if (Application.Current.IsRunningOutOfBrowser && /*_window.IsActive &&*/ (_isFullScreen != IsFullScreen))
{ {
if (IsFullScreen) // SL is missing out of browser window control if (IsFullScreen) // SL is missing out of browser window control
{ {
@ -52,14 +53,11 @@ public override void Update()
if (_pixelsDirty) if (_pixelsDirty)
{ {
_pixelsDirty = false; _pixelsDirty = false;
_bitmap.Lock();
for (int i = 0; i < BitmapWidth * BitmapHeight; i++) for (int i = 0; i < BitmapWidth * BitmapHeight; i++)
{ {
_bitmap[i] = (int)_pixels[i]; _bitmap.Pixels[i] = _pixels[i];
} }
_bitmap.Invalidate(); _bitmap.Invalidate();
_bitmap.Unlock();
_image.Source = _bitmap; // shouldn't have to set source each frame; SL bug?
} }
} }
@ -73,11 +71,10 @@ private void SetImageSize()
private const int BitmapWidth = 560; private const int BitmapWidth = 560;
private const int BitmapHeight = 384; private const int BitmapHeight = 384;
private static readonly PixelFormat BitmapPixelFormat = PixelFormats.Bgr32;
private Image _image; private Image _image;
private WriteableBitmap _bitmap; private WriteableBitmap _bitmap;
private uint[] _pixels; private int[] _pixels;
private bool _pixelsDirty; private bool _pixelsDirty;
private bool _isFullScreen; private bool _isFullScreen;
} }