Archive for the '.NET' Category

My first Xbox 360 program (game?)

November 1st, 2008

Downloaded Microsoft XNA Game Studio 3.0 this weekend, could not resist to try it out.

With Visual Studio 2008, It can create games for Windows, Zune, and XBox 360.  Not interested to create Windows games, don’t have a Zune(yet), the only option left is to test it on my XBox 360.

To deploy your game onto XBox 360, you need a Creators Club Premium Membership.  Without this membership, you would not be able to connect your XBox 360 to your computer through XBox live.

Took out my credit card and $100 later, I am now a Creators Club Premium Member!


 

Set up XBox 360 with XNA Game Studio

  • Logged onto XBox Live from my XBox 360, went to Games Market Place, downloaded XNA Game Studio Connect.
  • Launched XNA Game Studio Connect, it spitted out a 25-character key for the first time.
  • On my PC, started  XNA Game Studio Device Center, entered the key, and the PC and XBox made the connection.

 

My first Game

If you used Visual Studio before, nothing is new here:

  • File => New Project, picked XBox 360 games
  • Seconds later, a game template was created
  • Pressed F5, VS deployed the game onto XBox, and my first “game” was running.

It was just a blue screen, not even a “Hello World” on it, but it was every exciting: this might change the landscape for XBox 360 game creation.  For a $100, .NET programmers can create games/applications for XBox 360 and Zune, it’s no longer a privilege for big game studios.

Posted in .NET, XBox, XNA Game Studio | No Comments »

WURFL and SSDS, part I

June 28th, 2008

A friend of mine asked me for some help on mobile device detection.  He introduced me to WURFL, a giant database contains mobile devices information in xml format, in a single file.

First thought came to mind was:  how do I store this thing in a database?  I Googled around, found a couple of .NET libraries working against WURFL, but they all directly working against the xml.  Queries are done against memory objects.

To store this thing in SQL 2005, would need to define a schema, too much work.

I just got access to the SSDS beta, what a perfect match:

  • No need to define any schema.
  • WURFL would be an Authority.
  • Devices would be the container.
  • Each device would be an Entity in the Devices container.
    • device_Id will be the entityId
    • device.Properties will hold the user_agent, fallback_id, and all the capabilities.

Within 30 minutes, I whipped up a console application, parsed the 8MB xml, and stored all the 5755 devices into SSDS.

Next, I will write a web service to query the data.

Posted in .NET, Mobile, SOA, SSDS | No Comments »

How to programmatically close a message box in .NET Compact Framework

March 24th, 2008

On Windows Mobile devices, there is a Time out setting for the Home or Today screen.  When this time out value is reached, WM will hide whatever program is running and display the Home/Today screen.

This causes a problem for one of my project.  In my project, if the MessageBox.Show(…) function is called and the home/today screen kicks in before the user closes the message box, my program is hidden, and the user has no way to get back in, except turn the device off then on again.

The reason is obvious, modal dialog boxes, like message boxes, block the UI thread until they are closed.  But how do you close a message box while it’s hidden?  After some googling plus try and error, I came up with the following solution:

 

const int WM_DESTROY = 0x02;

 

[DllImport("coredll.dll", EntryPoint = "FindWindow")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

 

[DllImport("coredll.dll", EntryPoint="SendMessage")]
private static extern uint SendMessage(IntPtr hWnd, uint msg, uint wParam, uint lParam);

 

public static void KillWindow(string className, string title)
{
    IntPtr handle = FindWindow(className, title);
    SendMessage(handle, WM_DESTROY, 0, 0);
}

public static void CloseMessageBox(string title)
{
    IntPtr handle = FindWindow("Dialog", title);
    SendMessage(handle, WM_DESTROY, 0, 0);
}

Posted in .NET, Mobile | No Comments »

MIX08 Sessions online

March 7th, 2008

If you don’t get to go to MIX, this years sessions are available here.   Lots of good stuff and good too see they built the whole thing with Silverlight.  So far, there are more than 60 sessions available, will take days if you go through them all.

Posted in .NET, ASP.NET, Silverlight | No Comments »

ASP.NET MVC Preview 2

March 5th, 2008

Another beta release from MSFT:  ASP.NET MVC Preview 2.

I mainly using MonoRail for my MVC stuff, have not looked at ASP.NET MVC yet, I only know ASP.NET MVC will support NVelocity view engine, which is the engine I use.

Posted in .NET, ASP.NET | No Comments »