Dear visitor, thanks for stopping by! If you want, you can follow all updates on Snowball.be via RSS. You can also follow me on Twitter or Facebook. More interesting posts from other Microsoft Regional Directors can be found at The Region.
Gill Cleeren     .NET 4 | Book | Book review | Silverlight     May 16, 2011    

Suppose you’re willing to start learning Silverlight enterprise development and you want a good book to start. There are quite a few really good books on the market covering Silverlight 4. If you’re interested mostly in getting to know how to work with data, services and other enterprise-related topics, my own book is a really good start (here you can read some reviews as well).

lite book

If you’re not really sure on whether my book will help you, you can purchase a lite (light) version of it now for a mere $9.95. That’s right: you get a few relevant chapters without spending a lot of cash. You can read more about it here.

Here’s what you get:

  • Design and develop rich data-driven business applications in Silverlight
  • Rapidly interact with and handle multiple sources of data and services within Silverlight business applications
  • Understand sophisticated techniques to work with data in your Silverlight business applications, including displaying data in Silverlight applications, binding data to Silverlight controls, getting data from services into Silverlight applications and much more!
  • Packed with practical, hands-on cookbook recipes, illustrating the techniques to solve particular data problems effectively within your Silverlight business applications
  • eBook available as PDF download
  Posted on: Monday, May 16, 2011 11:28:42 PM (Romance Daylight Time, UTC+02:00)   |   Comments [1]
         
Gill Cleeren     .NET 4 | ASP.net | ASP.net AJAX | ASP.NET MVC | Efficiency     January 7, 2011    

On January 24th, the first Belgian Web Camp takes place. Some updates have been done to the agenda, including another speaker being added.

WebCamps_signature_v2

This is the final agenda:

8:30 - 9:00 Welcome and registration

9:00 - 11:00 Opening Keynote – What’s new in the Microsoft Web Platform (Scott Hanselman, Principle Program Manager, Microsoft)
Just recently, Microsoft have released a bunch of new products that web developers can use to build websites and web applications.  Scott, Drew and Jonathan will take you on a whirlwind tour of what’s new in the Microsoft Web Platform, including ASP.NET MVC 3, NuGet and more.

11:00 - 11:30 Coffee Break

11:30 - 12:30 HTML5: How about today? (Katrien De Graeve, Developer Evangelist, Microsoft)
What is HTML5? With more and more browsers supporting HTML5, ECMAScript 5 and other web standards, developers now have a strong web platform they can use to create a new class of web application that is more powerful and interactive than ever before.  What's in HTML5 that lets us take our sites to the next level?
Expect demos and code!

12:30 - 13:30 Lunch

13:30 - 14:45 Come in as jQuery zero, go out as jQuery hero (Gill Cleeren)
jQuery is the web developers’ new favorite. This lightweight JavaScript library has developers writing JavaScript code again, and loving it! What previously needed 20 lines of code can now be done in just 3 lines. Who wouldn’t be enthusiastic? Microsoft showed its love for the library by fully integrating it in Visual Studio. I dare to ask: should you stay behind? In this session, we’ll take a look at jQuery and we’ll teach you what you need to know to get you on your way. More specifically, we’ll look at selectors, attributes, working with WCF, jQuery UI, and much more. You could easily walk out of this session wearing a sticker: “I love jQuery”!

14:45 - 15:15 Coffee Break

15:15 - 16:30 OData: Open Data for the Open Web (Jonathan Carter, Senior Technical Evangelist, Microsoft)
There is no shortage of valuable data being generated by applications, reports, tools, Web sites, etc. Unfortunately, this leaves many of us wishing we could programmatically access the data and logic behind an app, report, or Web site. To break down data silos and increase the shared value of data and its associated business logic through the Web, Microsoft has recently announced the Open Data Protocol which enables exposing any data source as a Web-friendly data feed. Join this session to understand what the Open Data Protocol (OData) is and how it adds end-user and developer value to many of Microsoft's leading products and services (such as SharePoint Server 2010, Microsoft Codename "Dallas", Windows Azure, SQL Server Reporting Services, SQL Server PowerPivot for Excel, Visual Studio, .NET, Silverlight, AJAX, etc.), as well as being accessible from a range of platforms such as Java and PHP. "

16:30 - 17:30 Closing drink

Registration can be completed here (there are a few seats left!!)
Location:
Business Faculty
St. Lendriksborre 6 / Font Saint Landry 6
Brussel - Neder over Heembeek 1120
Belgium

You can also watch the live stream but you need to register from here. And if you want to view the event from within your company, you can get a free breakfast (Register here)

  Posted on: Friday, January 07, 2011 9:31:20 AM (Romance Standard Time, UTC+01:00)   |   Comments [0]
         
Gill Cleeren     .net | .NET 4 | Microsoft | Personal     December 23, 2010    

It’s the time of the year again when we everyone starts reflecting on the year that has gone by. While 2010 was great, 2011 is certainly another great one coming up. So instead of thinking of what has been, let’s take a look into 2011… from a Microsoft developer perspective that it :)

Visual-Studio-2010-Ultimate

While 2010 was the launch year of Visual Studio 2010, in 2011 we’ll get several new things on our plate. No Visual Studio 2011, that’s true, although when thinking about the 18-24 month release cycle of Visual Studio, chances are that we’ll see the first alphas or betas late in 2011. Nothing is disclosed on this at the moment though, so that’s a pure guess of mine.

Microsoft_Silverlight

Silverlight will definitely see a new release in 2011. In H1 2011, we’ll have the beta and in the second half of the year, we’ll have a released version. Silverlight 5 brings many new features, you can watch Scott Guthrie’s keynote on the new version right here.

The statement that was put out with showing the early version of Silverlight 5 put all the blown-out-of-proportion-rumors about Silverlight’s death to rest. It clearly shows that any investment in Silverlight is a safe one, future-proof for years to come. I’m looking forward to doing many sessions on this new version in the new year, that’s for sure!

Heavily related to Silverlight is of course the further development of Windows Phone 7. Released late 2010, the new kid on the block has caused quite a lot of stir in the mobile world. Microsoft created a new, refreshing interface for their devices. Some things are missing, definitely, but due to the easy updating model that is in place, Microsoft can create and distribute updates easily, which is entirely different from previous versions of the mobile OS. Heck, comparing WP7 with Windows Mobile… I should not be doing that! Several (unconfirmed as of yet) updates have been rumored, the first one coming already in January, adding copy/paste functionality as a core function of the phone. Later updates are rumored as well, including a v7.5 in the second half of the year and even Windows Phone 8 in 2012. While these are based on rumors, it shows that Microsoft is both committed to the platform AND investing heavily in creating new, updated version of the OS.

windows-phone-7-logo

For me as a Silverlight developer, Windows Phone 7 was a gift. I practically didn’t have to learn anything new to become a mobile developer. The tooling around Windows Phone development is by far the best there is, just install the tools in Visual Studio and you’re good to go.

I now personally have a Samsung Omnia 7 (coming from an iPhone 3Gs) and I love the phone. It’s fast, stable (I didn’t restart it since I have it I think)… True, applications are still lacking a bit, but consider that the phone is only here for a couple of months and consider also there are already over 4000 apps in the store and you’ll understand that we’ll have an interesting year there as well. Oh and yes, Angry Birds will be coming to Windows Phone 7 as well (as said by Rovio on Twitter).

Speaking of mobile, 2011 certainly will be the year of the tablet. At CES, taking place in January, there will be a flood of tablets coming out. Small, large, somewhere in between, running Android or Windows 7, we’ll see them all. I do hope here on a strong answer from Microsoft, but there’s nothing confirmed yet. I’m sure we’ll see some really interesting stuff there as well.

To finish off with, let’s hope we’ll see in the new year the next version of Windows (Windows 8??) in some form. There’s very little known currently about the new OS though.

Enjoy these last days of 2010!

  Posted on: Thursday, December 23, 2010 2:11:42 PM (Romance Standard Time, UTC+01:00)   |   Comments [0]
         
Gill Cleeren     .NET 4 | ASP.net | Events     December 16, 2010    

OK, now what is a webcamp then?
Microsoft Web Camps are free events that allow you to learn and build on the Microsoft Web Platform. Good news: Web Camps are coming to Belgium!

The Belgian Web Camp event on 24th of January 2011 is a full-day event where will hear from Microsoft experts on the latest components of the platform, including ASP.NET MVC 3, jQuery, HTML5, OData and WebMatrix.
Scott Hanselman is doing a two-hour keynote together with James Senior. I’ll be doing the oData and JQuery sessions and Katrien De Graeve is doing the HTML5 talk.

Two options to registering for the event:

  1. Register to attend in-person: https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032472434&Culture=en-US
  2. Register for the keynote live stream and see how you could have free breakfast delivered to your company: https://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032472819&EventCategory=2&culture=en-US&CountryCode=US

Location: Business Faculty
St. Lendriksborre 6 / Font Saint Landry 6
Brussel - Neder over Heembeek 1120
Belgium
Timing: Monday 24 January 2011 – 8:30 to 17:00

WebCamps_signature_v2 (2)

Full agenda:

8:30 9:00

Welcome and registration

9:00-11:00

Opening Keynote by Scott Hanselman and James Senior on ASP.NET MVC 3 and WebMatrix

11:00-11:30

Coffee Break

11:30-12:30

HTML5: How about today? (Katrien De Graeve)

What is HTML5? With more and more browsers supporting HTML5, ECMAScript 5 and other web standards, developers now have a strong web platform they can use to create a new class of web application that is more powerful and interactive than ever before. What's in HTML5 that lets us take our sites to the next level?
Expect demos and code!

12:30-13:30

Lunch

13:30-14:45

Come in as jQuery zero, go out as jQuery hero (Gill Cleeren)

jQuery is the web developers’ new favorite. This lightweight JavaScript library has developers writing JavaScript code again, and loving it! What previously needed 20 lines of code can now be done in just 3 lines. Who wouldn’t be enthusiastic? Microsoft showed its love for the library by fully integrating it in Visual Studio. I dare to ask: should you stay behind? In this session, we’ll take a look at jQuery and we’ll teach you what you need to know to get you on your way. More specifically, we’ll look at selectors, attributes, working with WCF, jQuery UI, and much more. You could easily walk out of this session wearing a sticker: “I love jQuery”!

14:45-15:15

Coffee Break

15:15-16:30

Oh, look at that data: using oData to expose your data over the web (Gill Cleeren)

While applications, sites, tools all generate tons of useful data, it is sometimes hard to access that data from your own application. To increase the shared value of data, Microsoft has introduced the Open Data protocol. Using Open Data, we can expose any data source as a web-friendly data feed.
In this session, we'll start by looking at oData, to make sure that everyone is on board with all the concepts. We'll see how it adds value for the developer and the end user for many of Microsoft's products and services. We'll then look at how we can build our own oData services using WCF Data Services, from working with the basic concepts to more advanced features such as query interceptors and service operations.
Come and learn about information and entity services that are stunning in their simplicity!

16:30-17:30

Closing drink

  Posted on: Thursday, December 16, 2010 10:01:38 AM (Romance Standard Time, UTC+01:00)   |   Comments [1]
         
Gill Cleeren     .net 3.5 | .NET 4 | Efficiency | Silverlight | sl4     October 11, 2010    

After some time, I’m glad to announce that the official, world-renowned Silverlight Tour is coming to Belgium, the Netherlands, the UK and more countries, organized by Ordina Belgium. The second thing I’m glad about is that I’ll be the instructor for this training!

SilverlightTour

The most important link for all this: http://bit.ly/SilverlightTour, where you can find all information, registration and prices. Currently, we have an early bird offering ending in a few weeks for the first batch of sessions.

What is Silverlight Tour?

The Silverlight Tour Workshop is a three-day course on Silverlight 4, given all around the world throughout the USA, Asia and South-America. Ordina will organize the training in several European countries starting Q4 2010.

The training divides the content into three distinct areas: Design, Development and the Server-Side. Students should be able to develop Silverlight 4 applications once attending the workshop. The Workshop is structured with a mix of didactic lessons, demonstrations and hands-on labs.

Each student will leave the workshop having created several small Silverlight applications. This variety of learning techniques will ensure that all students become proficient in the technology quickly and in an exciting way.

Key values of Silverlight Tour

  • Learning Silverlight from an expert in the technology
  • Hands-on labs with Visual Studio and Blend make sure you get to apply your acquired knowledge
  • Architect Silverlight applications
  • Learn about LOB features such as data access and data binding

Why Silverlight?

Silverlight is Microsoft's approach to building RIA (Rich Internet Applications). The platform has since its introduction, taken the world by storm. Now at its fourth iteration, Silverlight is ready for building Line-Of-Business applications, building on the strong foundation of .NET.

Now is the time to learn Silverlight! Not only is Microsoft investing heavily in the platform, but Silverlight is also the base for Windows Phone 7, Microsoft's new mobile platform. And with WPF as the desktop variant, you can apply your knowledge on the web, on the desktop and on mobile devices.

The Silverlight Tour can help you achieve the knowledge you need to start building Silverlight applications today!

Our offering

The Silverlight Tour comes in 2 flavors, depending on your Silverlight knowledge.

If you don't have any experience with Silverlight yet, the Silverlight 4 Tour workshop is ideal for you. In this 3 day course, we are starting from scratch, teaching you the foundation for your Silverlight endeavours. After this training, you'll feel comfortable with the technology and can start building your own applications.

If you already have some experience with the platform, or you just followed the Silverlight 4 Tour, we advise you the Advanced Silverlight 4 workshop. In this 2 day training, we'll tackle the more advanced concepts such as MVVM, advanced data access and IOC.

We offer the combined course (Silverlight 4 Tour Workshop + Advanced Silverlight 4 workshop) at a reduced price.

  Posted on: Monday, October 11, 2010 3:10:14 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .NET 4 | Efficiency | ppt | Silverlight | sl4 | Speaking     September 29, 2010    

Yesterday, I gave a presentation at ReMix 2010 in Belgium, the third edition of this annual Microsoft event. My talk, Building an end-to-end Silverlight 4 application – Writing your Christmas Cards with Silverlight, was focused around the new and existing features in Silverlight 4, helping developers building Silverlight Line-Of-Business applications. These included data access, data binding, hardware access, drag and drop, right-clicking, Out-Of-Browser and Trusted applications.

The slide deck can be downloaded here and the entire demo can be found here.

  Posted on: Wednesday, September 29, 2010 10:20:40 AM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .NET 4 | .NET Show | Efficiency | Speaking | Windows Azure     September 26, 2010    

image

Dear readers, I’m excited to announce the launch of .NET Show, the Belgian podcast for .NET developers. I’ve been working on this project for some time now and today, we are launching the site AND the first episode!

What is .NET Show?

Together with Katrien De Graeve, I’ll be recording podcasts on .NET development (in the broad sense of the word, so everything related to .NET) from now on. Our goal is bringing you in contact with all corners of the Microsoft development stack, from Silverlight to Azure, from COM interop to ALM... In our podcasts, we are focusing (initially at least) on local guests and we will be doing most shows in Dutch. This way, we can differentiate ourselves from the numerous podcasts already available. The topics, while on .NET of course, can be something that the guests has been working on (a professional project, a hobby project), a technology you have been investigating, something you think that can be interesting for others to hear about etc.

The first first episode can be downloaded already. In this first episode, we are talking with Maarten Balliauw on Windows Azure and the Microsoft cloud strategy in general.
In episode 2, which we’ll put online in the coming week, I’m talking with Pieter Gheysens on ALM (Application Lifecycle Management) in Visual Studio 2010. And in episode 3, I’m sitting down with my co-author Kevin Dockx and we will be discussing WCF RIA Services in real-life projects.

If you are interested in doing a podcast, let me know! Send me a mail at dotnetshow@snowball.be and I’ll contact you. If you have any remarks or questions, send them to that address as well!

So, with that, I hope you’ll enjoy our podcasts! Head over to www.dotnetshow.be where you can find the first episode. If you want (and I know you will) to subscribe via iTunes or another podcast downloader, use this link: podcastIconTo add .NET Show to iTunes, go to Advanced – Subscribe to Podcast:
image

In the window that appears, enter the following URL: http://www.dotnetshow.be/syndication.axd:

SNAGHTML304f17f

.NET Show will now appear in your subscribed podcasts!

image

  Posted on: Sunday, September 26, 2010 11:50:36 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .net | .NET 4 | Efficiency | Silverlight | sl4 | VS2010     September 4, 2010    

In April, I was in the UK for speaking at the VBUG conference and I was impressed by a demo given by Josh Twist. He built using MEF and WPF a “marketplace” application. The goal of the application was mainly showing the dynamic capabilities of adding new functionality to an application through MEF (or in full, the Managed Extensibility Framework for Silverlight 4).

For a presentation I’m giving shortly, I rebuilt something similar but in Silverlight: the MEF Marketplace in Silverlight. The setup is the following: a user gets an overview of apps he purchased in the market place and can run these on demand. The market place app will download the applications available to the user after the application has started, so this app mainly is a hosting shell for the other ‘purchased” applications to run in. Of course, the sample is a demo and can be extended quite a lot. For example, in the current implementation, I hard-coded the list of purchased apps and there’s no option to buy new ones. Also, it could be extended so that when new apps are purchased, a duplex service notifies the client of this and MEF downloads the new app in the background.

But, instead of talking of what could be added, let’s take a look at what I currently built already! Here’s a screenshot of the application showing the "purchased” applications.

SNAGHTMLaf6bd

And here’s one of the apps (the Flickr Image search) running inside the "market place shell”.

SNAGHTMLb8796

Time for some code. Let’s begin with the market place itself.

I defined a contract interface for all applications that can be loaded in the market place, IMarketPlaceApplication.

public interface IMarketPlaceApplication
{
    string ApplicationName { get; }
    FrameworkElement MarketPlaceIcon { get; }
    FrameworkElement MainView { get; }
}
This interface defines that all my apps will (of course) have a name, a default view which will load as the landing screen when the app is loaded (MainView.xaml) and an icon to show in the list (MarketPlaceIcon.xaml). As these 2 latest ones are XAML files, you can put in whatever you like.

A very easy application that will be possible to load from MEF is the HelloWorldApplication. The project structure of this app is as follows:

image

As you can see, there’s a class called HelloWorldApplication, which implements the IMarketPlaceApplication and 2 xaml files. The HelloWorldApplication code is shown below:

[Export(typeof(IMarketPlaceApplication))]
public class HelloWorldApplication: IMarketPlaceApplication
{
 
    #region IMarketPlaceApplication Members
 
    public string ApplicationName
    {
        get { return "Hello MEF world"; }
    }
 
    [Import(typeof(Icon))]
    public FrameworkElement MarketPlaceIcon
    {
        get;
        set;
    }
 
    [Import(typeof(HelloWorldView))]
    public FrameworkElement MainView
    {
        get;
        set;
    }
 
    #endregion
}

This is our first encounter with MEF. The first line uses the Export attribute. This class is saying that it is available for someone to use, when someone requests an instance of IMarketPlaceApplication. A bit further, we are using the Import attribute on both the MarketPlaceIcon and the MainView. Here we are saying: MEF, search us a class that’s exporting itself as type Icon and HelloWorldView respectively.

These 2 latter instances will be inserted by MEF upon executing the application, that is, if MEF finds the corresponding export. These exports can be found in the 2 XAML files (in the code-behind). The HelloWorldView.xaml.cs code is shown next. Note the Export attribute: we’re telling to MEF that this type can be used where an Import is requested of the HelloWorldView type.

[Export]
public partial class HelloWorldView : UserControl
{
    
    public HelloWorldView()
    {
        InitializeComponent();
    }
}

The Icon.xaml.cs is pretty similar code-behind-wise (I think I invented that term here): here alse we are adding an Export attribute.

[Export]
public partial class Icon : UserControl
{
    public Icon()
    {
        InitializeComponent();
    }
}

The HelloWorldApplication is at this point a stand-alone application (it compiles to its own XAP file), but we’ll now build the Market Place shell that will host this app. The code download at the end of the article contains several sample applications (a Flickr app and a Facebook app).

Similar to a real market place application, our implementation will get a list of apps you purchased previously. Only these are available to you and will be shown. To get this list, I wrote a basic Silverlight-enabled WCF service that fetches this list of available applications. This service is hosted in this case in the hosting website. The code below shows this service, which in this case returns a hard-coded list of apps (note that I have some more apps already added here).

[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = 
    AspNetCompatibilityRequirementsMode.Allowed)]
public class MarketPlaceService
{
    [OperationContract]
    public List<MefApplication> GetAvailableApplicationsForUser()
    {
        return new List<MefApplication>()
        {
            new MefApplication(){ApplicationName="Flickr Image Search", 
                XapFileName="FlickImageSearch.xap"}, 
            new MefApplication(){ApplicationName="Hello World", 
                XapFileName="HelloWorldApplication.xap"},
            new MefApplication(){ApplicationName="MEFacebook", 
                XapFileName="FacebookApplication.xap"}
        };
    }
 
    // Add more operations here and mark them with [OperationContract]
}
 
[DataContract]
public class MefApplication
{
    [DataMember]
    public string ApplicationName { get; set; }
 
    [DataMember]
    public string XapFileName { get; set; }
}

The service uses the MefApplication class as a helper class: it contains the name of the application and more importantly, the name of the XAP file (this could easily be replaced with a Uri to the XAP file).

In the MefMarketPlace, the Silverlight Market Place application, we can create a web reference to this service. In the App.xaml.cs, I add a call to a new method, DownloadMyApplicationList():

private void Application_Startup(object sender, StartupEventArgs e)
{
    DownloadMyApplicationsList();
    this.RootVisual = new MainPage();
}

This new method makes the service call to get a list of available XAPs that I can use (apps that I purchased).

void DownloadMyApplicationsList()
{
    AggregateCatalog = new AggregateCatalog();
 
    container = new CompositionContainer(this.AggregateCatalog);
    CompositionHost.Initialize(container);
 
    MarketPlaceService.MarketPlaceServiceClient client = 
        new MarketPlaceService.MarketPlaceServiceClient();
    client.GetAvailableApplicationsForUserCompleted += 
        new EventHandler<MarketPlaceService.GetAvailableApplicationsForUserCompletedEventArgs>
            (client_GetAvailableApplicationsForUserCompleted);
    client.GetAvailableApplicationsForUserAsync();
}
 
void client_GetAvailableApplicationsForUserCompleted(object sender, 
    MarketPlaceService.GetAvailableApplicationsForUserCompletedEventArgs e)
{
    if (e.Error == null)
    {
        AvailableApplicationsForUser = e.Result;
        InitializeCatalog();
    }
}

In the callback method of the service, I call InitializeCatalog(). MEF has the concept of Catalogs: a Catalog can be used to tell MEF where it has to look for Parts. Several types of catalogs exist in MEF for Silverlight: the TypeCatalog, the AssemblyCatalog, the DeploymentCatalog and the AggregateCatalog. A TypeCatalog basically allows us to register a specific type with MEF: if I want MEF to know about a certain Export, I can register it in a TypeCatalog. An AssemblyCatalog tells MEF to look for parts in a specific assembly. The DeploymentCatalog allows us to specify a XAP file and MEF will look in the assemblies therein for parts. It also allows us to asynchronously download a XAP file. An AggregateCatalog can contain any number of other catalogs and more catalogs can be added at any time.

By default, if we don’t specify a Catalog for our application, MEF looks at the current XAP file and for each assembly it finds, it creates an AssemblyCatalog. It then combines these with an AggregateCatalog. That means that we can omit creating a catalog in our application: in this case, MEF will create a default one for us, with something similar to this code:

void InitializeCatalog()
{
    AggregateCatalog catalog = new AggregateCatalog();
 
    foreach (var deployedPart in Deployment.Current.Parts)
    {
        StreamResourceInfo resourceInfo = 
            Application.GetResourceStream(new Uri(deployedPart.Source, UriKind.Relative));
 
        Assembly assembly = deployedPart.Load(resourceInfo.Stream);
        catalog.Catalogs.Add(new AssemblyCatalog(assembly));
    }
 
    CompositionHost.Initialize(catalog);
}

Back to our application. If we look at the available catalogs in MEF, we can see that the DeploymentCatalog is a good candidate for what we need: we can use it to download a XAP file (the application that we want to load). After that, we can add each DeploymentCatalog to an AggregateCatalog. MEF will then make these available in our application and we can run the downloaded applications.

In code, this gives the following:

private CompositionContainer container;
void InitializeCatalog()
{
 
    foreach (var item in AvailableApplicationsForUser)
    {
        DeploymentCatalog deploymentCatalog = 
            new DeploymentCatalog(item.XapFileName);
        this.AggregateCatalog.Catalogs.Add(deploymentCatalog);
 
        deploymentCatalog.DownloadCompleted += (s, e) =>
        {
            //extend to give meaningful error handling
            if (e.Error != null)
                MessageBox.Show(e.Error.Message);
        };
 
        deploymentCatalog.DownloadAsync();
    }
 
    container.ComposeParts(this);
}

You can see that I use a CompositionContainer here. The container is well, like the word says it, a container where MEF puts all the parts, shakes it up and creates/composes parts.

We now have the code that runs when we start the application: it gets a list of all the applications we can use over the service and then it downloads the XAP files of these apps asynchronously. Each XAP file is downloaded using a DeploymentCatalog and these are added to an AggregateCatalog. This now makes our downloaded applications available to run.

Let’s now take a look at the UI where we’ll run the apps from. The following screenshot shows the UI:

image

The “Load my apps'” button on the top right will execute a command on the viewmodel that will load all available applications in the ListBox on the left.

image

When clicking on the “Load app” button, the selected application (here the Flickr app) is loaded:

image

Clicking the “Home” button unloads the app and returns us to the list screen.

The complete XAML listing can be found in the code download. The most important part is shown below. Note that there’s a ContentPresenter used here and it’s bound to the MainView property of the SelectedApplication. The latter is a property exposed on the viewmodel (see further). If no view/app is selected, this ContentPresenter won’t be visible and we’ll see the default UI again.

<Grid x:Name="LayoutRoot" Background="Black">
    <Grid.RowDefinitions>
        <RowDefinition Height="*"></RowDefinition>
        <RowDefinition Height="60"></RowDefinition>
    </Grid.RowDefinitions>
    <Grid>
        ...
    </Grid>
 
    <ContentPresenter Content="{Binding SelectedApplication.MainView}">
    </ContentPresenter>
    <Button Grid.Row="1" Content="Home" Margin="10" Background="#FFABE3FF" 
            Command="{Binding HomeCommand}" BorderBrush="#FF00AAFF" 
            Style="{StaticResource ButtonStyle1}" 
            Width="130" Height="40" HorizontalAlignment="Center" 
            VerticalAlignment="Center"></Button>
</Grid>

Time to look at the viewmodel now. Probably the most important part here is the ObservableCollection<IMarketPlaceApplication>:

[ImportMany(AllowRecomposition=true)]
public ObservableCollection<IMarketPlaceApplication> Applications
{
    get
    {
        return _applications;
    }
}

The ListBox in the UI is bound to this collection and since it’s an ObservableCollection, the UI will reflect changes to this collection. That’s important here, since the list of available apps won’t be known after the shell contacted the service. Note that the collection property is attributed with the ImportMany attribute. This is a sign for MEF that more than one part that is exposing itself with the same Export attribute (same type) is allowed. By default, this isn’t allowed since MEF wouldn’t know which one to use. Here, we want the ImportMany since we know that more than one app will be available and they all need to be exported as an IMarketPlaceApplication. Another important thing to note here is the AllowRecomposition option we used here. AllowRecomposition tells MEF that if during the run of the app more Exports become available for this Import, it’s OK to add them, in other words, to rebuild the composition.

The ContentPresenter in the UI bound to SelectedApplication.MainView. The SelectedApplication property is shown next.

private IMarketPlaceApplication _selectedApplication;
 
public IMarketPlaceApplication SelectedApplication 
{
    get
    {
        return _selectedApplication;
    }
    set
    {
        _selectedApplication = value;
        NotifyPropertyChanged("SelectedApplication");
    }
}

NotifyPropertyChanged is a simple method that raises the PropertyChanged event of the INotifyPropertyChanged interface.

private void NotifyPropertyChanged(string p)
{
    if (PropertyChanged != null)
    {
        PropertyChanged(this, new PropertyChangedEventArgs(p));
    }
}

The “Load apps” button in the UI is bound to the LoadAppsCommand. I use the MVVM Light RelayCommand here. In the execute code of the ICommand, I ask MEF to satisfy the Imports of the current class (the viewmodel). This basically tells MEF to look at the catalogs and bring all the Export(typeof(IMarketPlaceApplication)) into the ImportMany.

public RelayCommand LoadAppsCommand
{
    get
    {
        if (_loadAppsCommand == null)
        {
            _loadAppsCommand = new RelayCommand(
                    () =>
                    {
                        CompositionInitializer.SatisfyImports(this);
                        loaded = true;
                    },
                    () =>
                    {
                        if (loaded)
                            return false;
                        return true;
                    }
                );
        }
        return _loadAppsCommand;
    }
}

The LoadSelectedApplicationCommand and the HomeCommand respectively set the SelectedApplication property to the selected application in the list or null.

public RelayCommand<IMarketPlaceApplication> LoadSelectedAppCommand
{
    get
    {
        if (_loadSelectedAppCommand == null)
        {
            _loadSelectedAppCommand = new RelayCommand<IMarketPlaceApplication>(
                    (a) => 
                    { 
                        SelectedApplication = a; 
                    }
                );
        }
        return _loadSelectedAppCommand;
    }
}
 
 
public RelayCommand HomeCommand
{
    get
    {
        if (_homeCommand == null)
        {
            _homeCommand = new RelayCommand(
                    () =>
                    {
                        SelectedApplication = null;
                    }
                );
        }
        return _homeCommand;
    }
}

With that, we have successfully implemented the MEF Marketplace. As said in the very beginning, this can be extended quite a lot. Add a duplex service and a buying system that pushes a message to the client and trigger the client to download the linked XAP file is a nice way to start. The complete file can be downloaded below.

Enjoy!

Code download: MefMarketPlace.zip (868.99 KB)

  Posted on: Saturday, September 04, 2010 11:25:11 PM (Romance Daylight Time, UTC+02:00)   |   Comments [2]
         
Gill Cleeren     .NET 4 | Efficiency | Personal | Silverlight | Speaking | TechEd     July 13, 2010    

Microsoft just announced that all of us can help deciding which sessions will be delivered at Tech-Ed 2010 Berlin. That's a great way of making sure that the contents is what the public wants!

I've ran through the list and 4 of my proposals made the shortlist (which is good news :)).

  • Treasures for the C# developer in Visual Studio 2010
  • AJAX Tips and tricks: things you never knew that could be done in ASP.NET Ajax
  • Silverlight data access and services not for the faint of heart
  • The good, the bad and… well, that’s it: Comparing good and bad practices in Silverlight application development

If you would like me to deliver one of these sessions on the upcoming Tech-Ed, please vote for them at http://europe.msteched.com/sessionpreference . Of course, there are many really other interesting sessions there as well: I'm sure this will be a great conference!

Thanks for voting!

  Posted on: Tuesday, July 13, 2010 11:37:55 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .NET 4 | Book | Efficiency | Silverlight | sl4     May 22, 2010    

With my book I wrote together with Kevin Dockx, Microsoft Silverlight 4 Data and Services Cookbook available for a couple of weeks now, I decided to do a small search on reviews. I’ll be honest, I took all I could find right now.

9843_Mockupcover

Here’s the ones I found:

Richard Costall:

“Microsoft Silverlight 4 Data and Services Cookbook is a great publication, and worthy of a place any Silverlight developers bookshelf. The formula of ‘recipes’ works well, with well explained, yet simple examples covering almost everything you’d ask when starting out building business applications in Silverlight. It highlights Silverlight 2 and Silverlight 3 functionality differences, yet is right up to date on Silverlight 4.”

Complete review at: http://www.nxtgenug.net/Article.aspx?ArticleID=368

Vikram Pendse writes:

“My Review Comments : * * * * * (5 Stars)..Simple Amazing book !..Go and Grab your Copy Today !!! :)

Impressed with this Book?..want to have a look at? Ok ! What you see is what you get ! kidding..You can download a sample chapter right away !”

Complete review at http://pendsevikram.blogspot.com/2010/05/microsoft-silverlight-4-data-and.html

Damir Tomicic writes:

“Das Buch ist sehr praktisch geschrieben. Der Leser merkt sofort, dass Gill und Kevin die Ansätze selbst ausprobiert und für die Leser optimiert haben. Die gewählte Sprache ist einfach, die Beispiele auch für Anfänger geeignet. Ein guter Einstieg in das Thema.”

Complete review at: http://tomicic.de/2010/05/05/MicrosoftSilverlight4DataAndServicesCookbookGillcleeren.aspx

Review on Amazon.com

“Good Introduction to the Datagrid, Dataform, and different Services (4/5)”


Complete review at http://www.amazon.com/Microsoft-Silverlight-Data-Services-Cookbook/product-reviews/1847199844/ref=dp_db_cm_cr_acr_txt?ie=UTF8&showViewpoints=1

Interested in my book as well? It is available from Packt Publishing, Amazon.com, Amazon UK and many other retailers as well! I hope you enjoy it!

  Posted on: Saturday, May 22, 2010 10:06:33 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .NET 4 | ASP.net | Events     April 12, 2010    

I just noticed that the video of my session on ASP.NET 4.0 at DevDays Netherlands is online. You can watch it here: http://channel9.msdn.com/posts/matthijs/Whats-hot-in-ASPNET-40-by-Gill-Cleeren/

  Posted on: Tuesday, April 13, 2010 12:10:38 AM (Romance Daylight Time, UTC+02:00)   |   Comments [1]
         
Gill Cleeren     .net | .NET 4 | C# | Silverlight | sl4 | VS2010     April 12, 2010    

After beta’s and one RC release, starting today, we can get our hands on Visual Studio 2010 RTM. Just hours ago, Microsoft held a keynote on the release of their flagship IDE, Visual Studio 2010. This release coincides with the release of .NET 4.0 and of course Silverlight 4, which has its official launch event tomorrow. This marks probably the largest release ever for developers from Microsoft.

 image

I need it badly

Visual Studio 2010 is like honey, developers swarm to it. It’s understandable that you want to get your hands on the bits. Where can you get them?
If you’re an MSDN subscriber, you’re in luck, as you can get all the bits from the MSDN subscription site. (http://msdn.microsoft.com/subscriptions)
If you are not, you have the following options:

image

 

Why you need it

If I wanted to make a list of reasons why you should be upgrading to Visual Studio 2010, I would be up all night I think. Since it’s quite late already, I’m going to make an all-but-complete list with my top features that make Visual Studio 2010 an not-to-miss upgrade. (For the complete list – you’re warned, it’s very complete – take a look here: http://msdn.microsoft.com/en-us/library/bb386063(VS.100).aspx)

The IDE looks really stylish!

Upon opening Visual Studio 2010 for the first time, you’ll immediately notice that something happened… Something big. No longer the traditional grey interface, but an exciting new look for the place you spend all your development hours in. Built entirely in WPF, the new shell offers plenty of extension points so you can make it feel even more like home.

image

New IDE features

I personally like the Navigate To function a lot (I blogged about it yesterday here: Visual Studio 2010 Tip- Navigate to functionality). Another one I like is the zoom in/out we can now do in the code editor. This is a real life-saver when doing demos on stage or when showing someone some code. Simply keep CTRL key pressed and rotate that mouse wheel of yours. For people who work on multiple monitors, Visual Studio now supports this much better!

Some other nice features:

  • Improved IntelliSense
  • Highlight references
  • Stub generation

New framework and languages

Visual Studio 2010 comes packed with new releases.

  • Silverlight 4 :) More on this at the launch event tomorrow!
  • C# 4.0 adds interesting new features to the language (more here). Also VB.net developers aren’t left outside in the cold, their favorite language gets an upgrade as well to Visual Basic 2010.
  • ASP.NET 4.0 as well as MVC 2 are born! If you want to get an overview of what’s new, download my talk of DevDays 2010 here. Most striking new features in WebForms 4 are client IDs, control over ViewState and more control over the HTML that’s being rendered.
  • Entity Framework makes a jump and goes straight to v4.
  • WCF and WF both get an upgrade to v4 as well.
  • TFS installation gets really simple using TFS Basic.
  • F# is now available for the functional programming needs.
  • SharePoint templates!

I want more

Not enough reading material for your brain? A free ebook is made available “Moving to Visual Studio 2010” here.

Warnings here!

Something to watch out for: currently, the Windows Phone 7 tools do not work with the RTM version of 2010. Read more on this here: http://forums.silverlight.net/forums/t/175181.aspx 

image

  Posted on: Monday, April 12, 2010 11:54:13 PM (Romance Daylight Time, UTC+02:00)   |   Comments [1]
         
Gill Cleeren     .NET 4 | Efficiency | VS2010     April 11, 2010    

Very often, you need to navigate to a class while coding. Perhaps a class you wrote yourself, perhaps you just want to see the members of a type of the .NET framework.

Visual Studio 2010 has THE ultimate feature for this, namely the Navigate To function. What you do, is hit CTRL + , (yes, indeed the comma) and it will open the Navigate To window, as shown below.

image

This window follows the same rules as the new IntelliSense: if I’m searching for a property “OverPaid”, I can search by typing Over… or just use OP.

image

If you have some text already selected in the code editor, the window will perform its search from there.

image

  Posted on: Monday, April 12, 2010 12:04:55 AM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .NET 4 | Visual Studio.net     April 8, 2010    

Are you counting down the days to the Visual Studio 2010 launch as well? I really hope so, as it’s the biggest release for developers EVER! The list of new features is way too long to put in a simple post, so therefore I encourage you to watch the keynote live next week on April 13th 8AM PST (that’s 5PM in the afternoon Belgian time). Click here to add the event straight to your Outlook calendar.

  Posted on: Thursday, April 08, 2010 11:02:52 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .NET 4 | Events | Silverlight | sl4 | Slide decks     April 4, 2010    

Overlapping with the Dutch DevDays event this year, I was of course present at TechDays 2010 Belgium as well. TechDays really became a big event with lots of attendees, speakers and sponsors. Never before had the line-up of speakers been so impressive, with names such as Anders Hejlsberg, Scott Hanselman, Charley Kindel… The feedback that I’ve heard was very positive, with the general comment being that the session content was good, deep dive and well brought by the speakers.

I got 2 session slots:

  • Silverlight 4 Tour de Force with a little WPF 4 sauce on top (together with Katrien De Graeve)
  • Building Data-Driven applications FAST with RIA services and Silverlight

As promised during the talks, I have uploaded all slide decks and demos for both sessions below. You can download them and use them as you like.

  • Silverlight 4 Tour de Force with a little WPF 4 sauce on top
  • Building Data-Driven applications FAST with RIA services and Silverlight

I took some pictures during the event as well. Below I posted some, the entire set can be seen here.

IMG_0079 IMG_0106 IMG_0083

IMG_0095 IMG_0104 IMG_0092

  Posted on: Sunday, April 04, 2010 5:06:40 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .NET 4 | ASP.net | Slide decks     April 4, 2010    

On March 29th and 30th 2010, DevDays 2010 Netherlands took place for the 13th time.  The event, if I heard and remember correctly, had over 2300 attendees and 120 developer sessions.

I was there, for the second year in a row, as speaker and gave a talk on ASP.NET 4.0. The session slides and demos are available for you to download and use:

Slides

Demos

Here are some images of the event I took with my phone.

IMG_0044 IMG_0014 IMG_0070

IMG_0061 IMG_0056 IMG_0046

IMG_0053 IMG_0063 IMG_0069

The rest of the pictures can be found here.

  Posted on: Sunday, April 04, 2010 4:37:27 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .NET 4 | VS2010     October 21, 2009    

The new shell written in WPF in VS2010 opens a whole set of options. Take for example the Recent Projects module. In previous versions, it always showed the last opened projects, without giving us any influence on what it should be displaying. It happened to me a lot that I’m working on a project, but by giving a session with some demos, my “real” projects were removed from the list.

In VS2010, we now have the option to tweak it like we want.

image

For example, we can pin a project, so that it isn’t removed anymore, like so:

image

Or we can remove any temporary or old projects as shown below:

image

  Posted on: Wednesday, October 21, 2009 11:31:03 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
Gill Cleeren     .NET 4 | TFS | Visual Studio.net | VS2010     October 20, 2009    

One of the new features of the 2010 platform, is the ability to install Team Foundation Server on a client OS, like Vista or Windows 7, 32 or 64 bit. It runs on SQL Express as database, which if not installed on your machine, will be installed by the setup configuration of TFS.

My personal setup is going to be a virtual machine in which I install TFS Basic. From my host OS, which has VS2010 installed along with Team Explorer, I can easily connect to it.

In this post, I wanted to show how easy it is to get things running on a Windows 7 (virtual) machine.

1. Installing Team Foundation Server

The installation for TFS basic is the same as for the fully-featured version. Run setup.exe from the disk (32bit or 64bit, depending on your OS).

You should see the following wizard.

1

2

By default, nothing is checked. Check the Team Foundation components checkbox.

3

4

5

2. Configuration of TFS so that it will become TFS Basic

At this point, things have been installed, but nothing is running yet. The configuration wizard should start up, as shown in the following screenshot.

6

Now we get the choice to either install basic, advanced, application tier or upgrade. Select upgrade and click on Start Wizard. This wizard will now guide you through the required steps. On my machine, SQL Server Express 2008 was already installed, so the wizard skipped this installation.

7

8

 9

 10

The wizard will now check if all my selections are possible with my config. If so, we can continue.

11 

Success, we’re good to go!

12

Installation has started.

 13

Finished setting up everything…

 14

TFS Basic is ready, here’s the address of your personal TFS Basic server.

 15

3. Team Explorer is called to the scene

To use my TFS instance from Visual Studio, I need to install Team Explorer. It can be found on the installation iso from TFS. Run its setup.

 16

 17

Installing…

18

And complete!

 19

4. Visual Studio 2010 now with Team Explorer

In Visual Studio’s Team Explorer, click on Connect with Team Project. Add your server as shown below:

20

From File > New Team Project, you can start a new team project.

21

And there we have it, a completely configured system with Visual Studio 2010 and TFS Basic!

22

  Posted on: Tuesday, October 20, 2009 1:50:00 PM (Romance Daylight Time, UTC+02:00)   |   Comments [0]
         
2/4/2012   4:02:17 PM
 Welcome to Snowball.be
Hello and welcome to snowball.be!

My name is Gill Cleeren, I'm a Microsoft Regional Director and an MVP ASP.NET.
On Snowball.be, you'll find all kind news and articles on .net, ASP.NET, WPF, Silverlight and Microsoft in general.
More on me can be found on my about page.

Should you have any questions, don't hesitate to contact me by Send mail to the author(s) .

 Partner sites
 Most popular tags
.net (124) .net 3.0 (6) .net 3.5 (18) .NET 4 (18) .NET Show (1) ADO.net (4) ASP.net (53) ASP.net AJAX (4) ASP.NET MVC (3) Atlas (12) Azure (2) Blend (2) Book (5) Book review (4) C# (43) Case studies (1) Chopsticks (3) Community (10) Community Day (15) Consoles (1) Database (1) DevDays09 (4) DotNetNuke (4) Efficiency (57) Enterprise Library (5) Events (60) Expression (7) Games (3) Hardware (9) Internet (18) IT (1) jQuery (1) LightSwitch (3) Links (11) LINQ (4) Mac (2) Metro (1) Microsoft (75) Mix 07 (6) Mix 08 (4) Mix 09 (1) Mix 11 (1) Movies (4) MVP (5) MVP Summit 2008 (3) mvvm (1) Office 2007 (10) Other (8) PDC (22) PDC2008 (10) Personal (36) ppt (9) Programming (52) Programming tools (22) Regional Director (2) Silverlight (142) Silverlight Advent Calendar (24) sl4 (44) Slide decks (13) Snowball (13) Software (20) Microsoft (25) Speaking (14) SQL Server (10) TechDays (13) TechEd (14) telerik (6) Telerik (6) TFS (1) Twitter (1) Vista (73) Vista Tricks (9) Visual Studio.net (38) Visug (33) VS2010 (8) Wallpaper (2) WCF (2) Webcasts (9) Webinars (5) Windows (41) Windows 7 (5) Windows 8 (1) Windows Azure (2) Windows Mobile (3) Windows Phone 7 (2) WinFX (17) WinRT (1) WP7 (2) WPF (40) XAML (24)

 On this page
 This site
 Archives
Navigation
 Sitemap
 Blogroll OPML
 Disclaimer

All content is property of www.snowball.be. Nothing on this site can be copied or published elsewhere, unless otherwise stated.

This site is made by Gill Cleeren.

Questions? Opinions? Send mail to the author(s) E-mail