Posts Tagged with microsoft.net

Microsoft PDC2008

PDC2008This year Microsoft’s Professional Developers Conference will be held October 27-30, 2008 at the The Los Angeles Convention Center.  Here is what MS has to say about the conference:

PDC2008 features more than 160 sessions covering a wide range of topics for professional developers and architects. These sessions provide an in-depth technical understanding of Microsoft’s future platform and offer practical guidance to help plan the evolution of your own products. Each session is delivered by Microsoft engineers and includes ample time for specific questions and answers.

They have only announced a few of the sessions and here are some of those focused on Silverlight.

  • Deep Dive: Silverlight Graphics Pipelines
  • Silverlight: Building Business Applications
  • Silverlight: Developing for Mobile Devices

Silverlight how to: On-demand assembly deployment

One of the cool new features of Silverlight 2 is the concept of on-demand deployment of assemblies. In most interactive development there is a desire to minimize the amount of data a user has to download to get your RIA up and running. The application package (XAP) size can grow quite quickly if one tries to include all of resources required to run the entire application. In Silverlight 2 we have the concept of a XAP file or compressed package (zip file). By default, the XAP contains an application assembly and any Silverlight assemblies that your application is dependent on (System.Xml.Linq, etc). In Silverlight 2 we have the ability to generate more than one XAP file giving us the opportunity to deploy additional assemblies on demand, asynchronously to the initial payload.

To leverage this technology one has to understand the concept of “AssemblyParts” and how reflection is used to extract an assembly from a downloaded XAP. The following example will show how one can code this functionality in Silverlight 2 Beta 1.

The first step in downloading an additional assembly is to go and get the XAP package. Note the use of a BaseAddress. In my example the base address is http://localhost/MultipleXap_Web/.

1
2
3
4
5
Uri addressUri = new Uri(_baseUri, "ClientBin/MultipleXap1.xap")
System.Net.WebClient wcXap1 = new System.Net.WebClient()
wcXap1.BaseAddress = _baseUri
wcXap1.OpenReadCompleted += new OpenReadCompletedEventHandler(wcXap1_OpenReadCompleted)
wcXap1.OpenReadAsync(addressUri)

Once downloaded, the “OpenReadCompleted” event will fire and one can extract the assembly from the XAP. I have chosen to factor into a method the logic used extract the Assembly from the compressed zip file. In the event that we had multiple assemblies we could use Linq to navigate the xml of AppManifest and programmatically load each assembly.

1
2
3
4
5
6
7
8
9
10
public Assembly LoadAssemblyFromXap(string relativeUriString, Stream xapPackageStream)
{
    Uri uri = new Uri(relativeUriString, UriKind.Relative)
    StreamResourceInfo xapPackageSri = new StreamResourceInfo(xapPackageStream, null)
    StreamResourceInfo assemblySri = Application.GetResourceStream(xapPackageSri, uri)
 
    AssemblyPart assemblyPart = new AssemblyPart()
    Assembly a = assemblyPart.Load(assemblySri.Stream)
    return a
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
void wcXap1_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
    if ((e.Error == null) && (e.Cancelled == false))
    {
        // Convert the downloaded stream into an assembly
        Assembly a = LoadAssemblyFromXap("MultipleXap1.dll", e.Result)
 
        /****************************************************************
         * The following should work  since I did the following
         *
         *   "added a reference to second assembly then specified that 
         *    the library assembly that is referenced by the application
         *    project is not included with the application package
         *    when the application assembly is built"
         *   
         *  This syntax compiles, but DOES NOT run correctly
         ****************************************************************
         * MultipleXap1.Page page = new MultipleXap1.Page()
         ********************************************************/
 
        object page = a.CreateInstance("MultipleXap1.Page")
        //Insert UserControl into the Primary grid.
        this.LayoutRoot.Children.Add(page as UserControl)
    }
}

Once the assembly has been extracted, we can create an instance of the selected UserControl by using the “CreateInstance” method on the Assembly object. Based on Microsoft’s documentation, we should have been able to add a project reference to the on-demand XAP, within our default Silverlight Application. This would give us access to that second assemblies types. We can make the reference and the project compiles, but throws an exception at runtime. CreateInstance is not a preferred approach since it drastically limits how we can leverage the strong typing of objects instantiated from this reflected assembly.

Code: MultipleXap.zip

My Mix08 Experience

Even though Mix08 is now only a distant memory, the inspiration I leave with will last for quite a while.  There is something quite powerful about being around thousands of professionals that are as passionate and enthusiastic about the future of interactive development.  For months now I have had the special opportunity to be working close with Microsoft and the there development of the Silverlight 2 Beta.  We have seen first hand the power and potential of the platform. It was great to share that excitement with the rest of the development community.

In the weeks to come, I look forward to sharing our discoveries as we learned how to leverage the Silverlight 2 framework to build our most recent casual game.  Look for posts on the techniques and methodologies we found most effective.

Interactive Design Firm Powers Casual games

A month ago Microsoft selected Terralever to conduct a in depth Case Study on our use of Silverlight 2 for creating a new Miniclip.com game Tunnel Trouble. This process was really exciting for Terralever.  I feel Microsoft did a great job of capturing the value we find in Silverlight and how this powerful framework allowed us to create a compelling casual game in less then 5 weeks. Miniclip

Microsoft Phizzpop LA design challenge

After 4 incredibly intense days, Microsoft’s Phizzpop LA design challenge is complete and Cynergy Systems is the winner. Congratulation’s Cynergy!  I was certainly disappointed that we did not win, but with only 7 minutes to present your strategy, design and concept everyone had a chance to win.

After catching up on some overdue sleep, I can say that although it was extremely intense (only 20 hours of sleep this past week), it was an incredible experience. My teammates Scott McAndrew and Craig Budwitz were amazing, and I am extremely happy with our Silverlight 1.1 prototype.

LA 2007 Design Problem:

phizzpop_logo.gifYou and your team have just been hired by a consortium representing all of the major Movie and Television studios. Your team constitutes the Office of the President of Products. You are responsible for determining the product strategy for this consortium. While your authority is considerable, it is not absolute.

You must pitch your product solution to the Board of Directors, also known as the Judges.

The media industry is facing an unprecedented set of challenges today. Digital distribution, a dramatic reduction in traditional advertising, the rise of social networks such as MySpace and Facebook and other factors have all combined to force a fundamental rethinking of the entertainment industry.

Your job is to:

  • Find new ways to monetize the deep catalog of content that the consortium has. You should specifically be thinking beyond simply pay per download, subscriptions or advertising
  • Look for new ways to create fans of our content. Sites like MySpace and Facebook (among others) have shown us that social networks are powerful tools. Figure out how to exploit the principles of social networking, integrate into existing networks, or both
  • Look for ways to exploit the Long Tail. The consortium has a fantastic amount of old content that’s very valuable to many people. Figure out how to best help our users find existing content, discover other content, and share this with friends
  • Figure out the device & platform landscape. Between iTunes, the iPod, Zune, Media Center, UnBox, Xbox Live, Joost, and everything else, it’s difficult to understand the overall experience system for our users. Explore creating your own, partnering, or both

As you can see from the design problem, it is very deep. Executing on each of these points in a working Silverlight prototype, in a mere 3.5 days, is an impossible task. Terralever put forth a strong effort, here is a series of captures from our working prototype.

Sometime next week I will post a link to the live prototype as well as some posts on Silverlight 1.1 techniques we used to build the appliction.

C# 2.0 Language Features for Late Comers

uat.gifC# 3.x is exciting and deserving of the spotlight, but thousands of coders are in jobs still maintaining 1.x projects and just now getting up to speed on 2.0. Some haven’t had a chance to get hip to generics and anonymous delegates.


Event: Desert Code Camp 2007
Location: University of Advancing Technology
 2625 W. Baseline Road (map)
 Tempe, Arizona 85283
Time: Saturday, September 15, 2007 - 11:45am
Presentation: Click to Download

Designing and Developing Enterprise Applications Using the Microsoft .NET Framework

MCPD Self-Paced Training Kit (Exam 70-549): Designing and Developing Enterprise Applications Using the Microsoft .NET FrameworkThe publisher states: “Comprehensive exam prep study guide written by exam-certified authors -In-depth coverage of exam objectives and sub-objectives–plus instructive case studies and troubleshooting scenarios to enhance your performance on the job -425+ practice and review questions -Test engine that enables customized testing, pre-assessment and post-assessment, and automated scoring and feedback -Complete objective-by-objective review section, plus a handy exam-mapping grid”

Microsoft .NET Framework 2.0 Application Development Foundation

Microsoft .NET Framework 2.0 Application Development FoundationThe Publisher states “Comprehensive study guide written by exam-certified authors - Deeper, more focused coverage of exam objectives and sub-objectives-plus instructive case studies and troubleshooting scenarios to enhance your performance on the job - 425 practice questions on CD - Test engine that enables customized testing, pre-assessment and post-assessment, and automated scoring and feedback - Complete objective-by-objective review section, plus a tear-out exam-mapping grid - Exam tips based on real-world test experience - 90-day evaluation version of Visual Studio 2005 Professional Edition - 15 percent exam discount voucher from a leading authorized testing center (limited time offer).”