A new Silverlight framework for creating managed code splash screens, pre loaders and loader projects

by APIJunkie 11/7/2008 10:54:00 AM

We released a new open source project called Silverlight loader on CodePlex today.

The project is basically a simple and light framework aimed at taking the pain out of writing splash screens, pre-loaders and loaders.

To find out more info check out the Silverlight loader getting started guide and how the Silverlight loader works.

Thanks to Silverlight Girl's talent you can view an artistic demo here.

Hope you find it useful.

  JB

Currently rated 5.0 by 3 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Silverlight | news

A new forum dedicated to Silverlight game development and design

by APIJunkie 10/27/2008 7:21:00 AM

As some of you may know, a couple of months ago Silverlight Girl decided to create a centralized place where people can display their Silverlight game creations. The great community reaction encouraged us to continue and maintain the site.

Over the past few months we have received many game submissions and supportive emails. Some of you have been suggesting we offer a place where people can exchange ideas about Silverlight game design and development. Last but not least was Daniel Gimenez the author of the now famous Vector Space Zer0.

Fast forward a couple of weeks of work on our spare time and thanks to the YAF project, the Silverlight game forums are now live.

We hope you will find them helpful and feel free to post any comments and suggestions you may have.

JB

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Silverlight | Games | news

Step by step on how to upgrade Silverlight 2 beta 2 to Silverlight 2 RC0

by APIJunkie 10/3/2008 10:30:00 PM

Since I had to do this a couple of times on different machines I thought this might be useful for others.

Here is the list of steps I take to upgrade a Silverlight 2 beta 2 development machine to Silverlight 2 RC0.

First the pre requisites:

0.0 Because Blend version 2 can't live happily with older preview versions, you will need to uninstall Blend 2.5 June Preview or any other version of Blend 2 preview you may have on the machine.

0.1. You will need Visual Studio 2008 SP1 and .Net 3.5 SP1, so if you haven't done so before, install Visual Studio 2008 SP1(this will install .NET 3.5 SP1 as well).

Now the actual installation steps:

1. Install Microsoft Silverlight Tools for Visual Studio 2008 SP1(this will uninstall Silverlight 2 beta 2 SDK if need be...)

2. Install Blend 2 or Blend 2 trial version.

3. Install Blend 2 Service Pack 1 Preview.

You should be good to go.

Regarding breaking changes here are a couple we encountered:

1. The DataGridTextColumn property DisplayMemberBinding has been renamed to Binding.

2. TextAlignment was removed from button styles.
 

Good luck!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Silverlight | Visual Studio | Blend

The Silverlight game list on Mashooo.com crosses the 50 game mark and changes format

by APIJunkie 9/14/2008 5:59:00 AM

Silverlight girl has been maintaining a rapidly growing list of Silverlight games on Mashooo.com for a couple of month now.

The list has recently passed the 50'th game mark. It seems like every day there is a new Silverlight game popping out there

and that there are some very promising talents that are trying to peruse game development on the Silverlight platform.

Because maintaining the list was getting out of hand Mashooo.com has recently changed format.

One of the main changes is that any one can now easily submit new games and also rate and comment on the available games.

I hope you enjoy the new format and that the list will help raise awareness to Silverlight game development and what it can bring to the world of casual web based games.

JB

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Silverlight | Games | news

Fix for Could not download the Silverlight application error

by APIJunkie 8/2/2008 10:08:00 AM

If you receive the following error:  Could not download the Silverlight application. Check web server settings.

The problem might be the fact that the .xap mime type is not registered on the IIS server you are using.

If you have control over your server then you can just register the missing mime type.

If you are not that lucky you might need to find a workaround like the one below.

The idea is based on an older solution for Silverlight 1.0 and xaml files.

Since the problem is do to the fact that xap is not a registered mime type, we can cheat a little by creating an http handler that will handle requests for xap files.

The http handler will deliver the content of the xap file using a mime type that is known to the server. 

Since a xap file is actually a zip file we can use that mime type as the delivery content type.

Example:

Create a new class file called HttpXapHandler.cs.

Copy the following code to the file and add the file to your App_Code directory.

/// <summary>

/// HttpXapHandler class - handle requests to xap file through a back door nick named x-zip-compressed.

/// </summary>

public class HttpXapHandler : IHttpHandler

{

public void ProcessRequest(HttpContext context)

{

// get file name from request query string

string fileName = context.Request["fileName"];

// check if the file is valid -> its up to you to validate in a way that makes sense to you...

if (!validateFile(fileName))

{

context.Response.Write(
"<br>Bad file request<br>");

context.Response.End();

}

// set mime type to zip file because a xap file is actually a zip file

context.Response.ContentType = "application/x-zip-compressed";

context.Response.TransmitFile(context.Server.MapPath(fileName));

context.Response.End();

}

// naive test for valid xap file -> just test if the file requested is actualy a .xap file

public bool validateFile(string fileName)

{

fileName = fileName.ToUpper();

if ((fileName.Length > 4) &&(fileName.Substring(fileName.Length - 4).CompareTo(".XAP") == 0)

)

return true;

else

return false;

}

public bool IsReusable

{

get

{

return false;

}

}

}

// EOF HttpXapHandler

After you created the http handler add the following line to your web.config file inside the httpHandlers section(note the bold part):

<httpHandlers> <add verb="*" path="GetXapFile.ashx" type="HttpXapHandler" validate="false"/>

</httpHandlers>

Now that we have an http xap handler our web site should be able to accept requests like this:

http://www.MySiteNameGoesHere.com/getXapFile.ashx?fileName=Silverlight2.xap

To actually use this inside a web page take a look at the next example.

Usage example:

To access the .xap files in your web pages you will need to replace each occurrence of the source=[xap file name] with source=getXapFile.ashx?fileName=[xap file name].

In your html page this will look something like the following (note the bold part):

<div id="silverlightControlHost">

<object data="data:application/x-silverlight," type="application/x-silverlight-2-b2" width="100%" height="100%">

<param name="source" value="getXapFile.ashx?fileName=mySilverlight2file.xap"/>

<param name="onerror" value="onSilverlightError" />

<param name="background" value="white" />

 

<a href="http://go.microsoft.com/fwlink/?LinkID=115261" 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>

good luck!

Currently rated 5.0 by 3 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

IIS | Silverlight | Troubleshoot

Using Silverlight for efficient low level communications (UDP socket usage and port restrictions)

by APIJunkie 6/23/2008 10:04:00 PM

For all of you guys that were hoping to use Silverlight for advanced low-level communications note the following excerpt

from the MSDN website about Working with sockets in Silverlight 2  beta 2:

"Currently, the only supported ProtocolType on Silverlight 2 is the TCP protocol.

One restriction on using sockets in Silverlight 2 is that the port range that a network application is allowed to connect to must be within the range of 4502-4534. These are the only ports allowed for connection using sockets from Silverlight 2 applications. If a connection is to a port is not within this port range, the connection attempt will fail."

This means that any UDP communication is banned and port number access is highly limited.

I for one hope this is only a temporary thing that would change in the final version 2 release.

The reason be is that there is a whole range of communication applications ranging from networking tools to multiplayer games that will never be implemented in Silverlight.

If Silverlight is to take its place as a true robust platform for RIA applications it should at the very least allow UDP access and a very wide range of port access.

Security concerns are important they should be addressed and dealt with but they should not cause this promising platform to become crippled.

JB

 

Currently rated 4.5 by 4 people

  • Currently 4.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Silverlight | Communications

Upgrading existing Silverlight 2 beta 1 code to beta 2

by APIJunkie 6/12/2008 5:59:00 AM

Silverlight girl and I recently upgraded Bumble Beegger to work with Silverlight 2 beta 2.

Some things were easier then others all in all it took a few hours to finish and was not a big ordeal.

If you are planning on upgrading your code you can find official Microsoft documentation about breaking changes between beta 1 and beta 2 here. Also note that the last minute correction and additions can be found here.

Below are some of the coding issues we encountered and how we solved them in the hope that this will save someone else some time:

1. FrameworkElement.Resources is a ResourceDictionary

Trying to a use Add without a key fails.

Example:

canvas.Resources.Add(value); // compilation error on beta 2

canvas.Resources.Add("key",value); // o.k. on beta 2
 

2. WebClient reference change

To use web client you will need to add a reference to System.net.
 

3. ApplicationSettings.Default was changed

ApplicationSettings.Default is not accessible you can use IsolatedStorageSettings.ApplicationSettings instead.


4. The type or namespace name 'DataGrid' does not exist in the namespace

You can find more info about this problem and the solution here


5. DataGrid syntax changes.

Example:

DataGridTextBoxColumn was changed to DataGridTextColumn

You can find more info about it here.
 

6. SetValue needs explicit cast to double.

Example:

item.SetValue(Canvas.LeftProperty, value); // compilation error on beta 2

item.SetValue(Canvas.LeftProperty, (double)value); // o.k. on beta 2
 

 

Currently rated 3.0 by 1 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Silverlight | Troubleshoot

Fix for the DataGrid does not exist in the namespace error in Silverlight 2 beta 2

by APIJunkie 6/10/2008 7:27:00 AM

When upgrading an existing Silverlight project to silverlight 2 beta 2 you might encounter the following error:

"The type or namespace name 'DataGrid' does not exist in the namespace 'System.Windows.Controls' (are you missing an assembly reference?)"

To solve the problem:

1. First go to your project references (Expand your project references sub tree in the Visual Studio IDE) and  look for System.Windows.Controls.Data in the reference list.

(If it does not exist in the list then you probably had the problem before the upgrade and you need to add a reference to System.Windows.Controls.Data by going to Project/Add Reference/.Net and choosing it from the list)

2. Press the right button on the System.Windows.Controls.Data reference and choose properties.

3. If the "Specific Version" property is set to true, change the "Specific Version" property to False.

4. Rebuild the project/solution.

This solved the problem for us on several Silverlight projects using a DataGrid.

Cheers

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Silverlight | PRB | Troubleshoot | How To

Getting around Silverlight 2 beta 1 error 4002 while changing visibility of a control on mouse click event

by APIJunkie 5/27/2008 11:27:00 PM

While working on  Bumble Beegger we came across a daunting problem that only seemed to happen under certain conditions.

Silverlight error message
ErrorCode: 4002
ErrorType: ManagedRuntimeError
Message: System.Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.
at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
at System.Windows.DependencyObject.MethodEx(String methodName, CValue[] cvData)
at System.Windows.UIElement.ReleaseMouseCapture()
at System.Windows.Controls.Primitives.ButtonBase.ReleaseMouseCaptureInternal()
at System.Windows.Controls.Primitives.ButtonBase.OnLostFocus(RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnLostFocus(Object sender, RoutedEventArgs e)
at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName) 

After a few hours of debugging, experimenting and googling I came across a discussion on Silverlight.net that shed some light on the problem.

As it turns out there is bug in Silverlight 2 beta 1 that can cause a crash when changing the visibility of a button control inside a mouse event handler.

The recommended workarounds around this problem were to change the size to 0,0 or change the opacity to 1.

Another option is to use the Canvas.ZIndexProperty and set it to a number that is smaller then your foreground elements.

The problem is that those does not always produce a similar enough effect in other elements.

If you still want to use visibility where possible, you can check the type of control and choose to modify visibility, size, opacity or Z Index according to the type.

Granted this is a horrible hack but it gets the job done until we can get our hands on beta 2...

Example:

// assume uiElement points to some valid UIElement

UIElement uiElement;

// check element type, if its not a button set visibility to collapsed else use ZIndex for a similar effect

if (uiElement.GetType() != typeof(Button)) 

   uiElement.Visibility = Visibility.Collapsed;

else

   ((Button)uiElement).SetValue(Canvas.ZIndexProperty, -1);

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Silverlight | PRB | How To | Debug

A new Silverlight web based game showing the potential of this new and exciting technology

by APIJunkie 5/21/2008 12:15:00 AM

Mashooo.com released a new Silverlight web based game today.

For those of you who have been sleep walking for the past few month. Silverlight is a new and exciting technology that looks like a promising candidate for next generation development of RIA applications.

The game is called Bumble Beegger and was built as a proof of concept for the usability of this new technology.

The game uses the Farseer Physics Engine that was developed by Jeff Weber of Farseer Games for gravity, movement and collision detection.

You can play Bumble Beegger for free with your web browser on Mashooo.com

Have fun and remember that it is a beta version and that any comments would be welcome...

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Silverlight | Games

Powered by BlogEngine.NET 1.2.0.0
Theme by Mads Kristensen

About the author

Name of author

My name is Bacon…James Bacon.

I am an API wars veteran I was wounded by x86 assembly, recovered and moved on to C. I am currently stuck in C++ and sniffing .NET.

I am mainly here to ramble about coding, various API’s, Junkies(me especially) and everything else that happens between coders and their significant other.

E-mail me Send mail


Calendar

<<  November 2008  >>
MoTuWeThFrSaSu
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

View posts in large calendar

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

Sign in