Andrej Tozon's blog

In the Attic

NAVIGATION - SEARCH

Blinded by Silverlight

Silverlight is quickly becoming my favorite tech toy I want to spend more working on in the future. New announcements regarding this technology, formerly known as WPF/E, were made at first day of this year's MIX, including:

  • Silverlight community site launch: a lot of cool samples, videos, quickstarts and other info is already available
  • New downloads: Silverlight 1.0 Beta, 1.1 Alpha, along with other designer/developer tools
  • Silverlight streaming: free media storage and delivery for your Silverlight apps from Microsoft
  • Other info: cross-platform version of .NET framework, built into 1.1 Alpha release, which means developing in a language of your choice (js, C#, VB, even Ruby and Python); VS "Orcas" and Expression Blend are *the* tools; go live license for 1.0 Beta; WPF-> Silverlight XAML conversion, ...

All this and more on just a first day... [see the MIX keynote here]

NetAdvantage for WPF

Infragistics released their NetAdvantage for WPF controls suite. There's just a couple of controls included, but they look mighty fine and powerful. You can take a look at their XAM Showcase in XBAP flavor here [.NET FX 3.0 is required in order to run the Showcase].

[Update: Infragistics offers discounted suite, along with free xamDataGrid, to current MSDN subscribers]

MVP!

This is great! Not only this year started with the greatest award of them all - the DAD award, now Microsoft presents me with the MVP award for "Visual Developer - Client Application Development". Big thanks to Luka and Microsoft, fellow local MVPs for all the support and all of you who helped along!

Jetpac Refueled

This may just make a valid reason for me to get me an Xbox 360. Jetpac was one of the first games made for ZX Spectrum, and we used to play it for countless hours back in the eighties. It was released by Ultimate - Play The Game [makers of many legendary Spectrum games, including Atic Atac], and now, Rare, descendant of Ultimate, decided to re-release their first title, but with complete visual makeover and enhancements, worthy of contemporary console like Xbox 360.

Of course this is just a serious nostalgia trip... I'll probably never buy an Xbox, but I'm sure someday I'll be able to find someone who'd let me try this baby out, Retro mode included [see picture below] :) One thing will for sure be different - as Rare wrote on their Jetpac Refueled introduction page - I won't have to wait 5 minutes for it to load...

Jetpac Refueled - Retro mode

More info on Xbox Live Arcade

Alt-Tab flipping in Windows Vista

When running Windows Vista on a non-graphic-capable PC [not having at least DirectX 9 capable graphics processor], you lose the comfort of enjoying eye-candy features like Aero Glass, Flip 3D [Win-Tab switching] and graphically enhanced Windows Flip [Alt-Tab switching]...

What you can start to enjoy [even without having a capable graphics card], is the ability to switch to preferred application simply by clicking its icon while holding the Flip window open. Proves useful when having a lot of applications open at once. In pre-Vista Windows editions you'd have to tap the Tab key a few times to get desired application's tile selected and release the keys to set application focus.

Client Application Services and Membership provider

In previous VS "Orcas" post, we took a peek at Client Application Services, a part of .NET Framework 3.5 and the related System.Web.Extensions.dll. We also created a simple WCF LoginService, used for authenticating users against a Membership database, similar to what we're already using with ASP.NET 2.0.

Now, we're going to use that same login service, but in a different way. We won't be calling that service directly; instead, we're going to make our Login form call that service automatically, whenever our application would require user authentication. Sounds like what your current ASP.NET application is doing? Enter ClientFormsAuthenticationMembershipProvider...

The scenario is pretty much the same as with building web application. For starters, let's take our existing ClientService WCF project, and add a new Windows Forms project... I've called it ClientApplication. Before continuing, we'll have to add references to System.Web.dll and System.Web.Extensions.dll assemblies

Our first step is building a simple LoginForm to make user provide a username and a password. Adding the "Remember me" checkbox is optional, but you'd be missing out if you omitted it.

The important part in making a login form is implementing IClientFormsAuthenticationCredentialsProvider interface. This interface only cone method we'll have to implement - GetCredentials(). We'll use this method to return entered user credentials to the calling Membership provider:

public ClientFormsAuthenticationCredentials GetCredentials()
{
    ShowDialog();
    ClientFormsAuthenticationCredentials credentials = 
new ClientFormsAuthenticationCredentials(usernameBox.Text,
passwordBox.Text, rememberMeBox.Checked); return credentials; }

All that's left is to configure Membership provider to use and connect our LoginService and our Login form. Here's a snippet to include in our app.config file:

<membership defaultProvider="Default" >
  <providers>
    <add name="Default" 
       type="System.Web.ClientServices.Providers.
ClientFormsAuthenticationMembershipProvider,
System.Web.Extensions, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
credentialsProvider="ClientApplication.LoginForm,
ClientApplication"
serviceUri="http://localhost:51304/ClientService/LoginService.svc" /> </providers> </membership>

To use our Membership provider, simply call Membership.ValidateUser(string.Empty, string.Empty) from anywhere in the code to trigger provider asking for user credentials. When triggered, our Login form would be displayed and entered credentials would be validated against out Login service. After successful validation, application will continue to run in the context of validated user.

We've only just scratched the surface of what Client Application Services have to offer, there's a whole lot more goodies out there. More on that in next posts.

No more excuses...

... for not running Visual Studio 2005 on Windows Vista. Visual Studio 2005 Service Pack 1 Update for Windows Vista is available for download. Remember to uninstall the Beta before installing this release version.

And if you've installed SQL2005 SP2 already, here's a critical hotfix you may want to apply... This fix is however included in the refreshed SP2 package, so if you download it now (goes for downloads after 5th of March), you'll be fine.