My name is Edward Tanguay. I'm an American software and web developer living and working in Berlin, Germany.
9 hours ago: Here's a use-case for datapod format, recording human-readable data that later can be used as a datasource: http://is.gd/eSsLg @pholdings.
9 hours ago: "Subscriptions are available to U.S. addresses only." http://www.highlights.com another global economy #fail.
10 hours ago: "Subscriptions are available to U.S. addresses only." http://www.highlights.com another global #fail.
11 hours ago: My notes on podcast with author Aimee Bender's Lemoncake book, "a normal kid punished by expectations of giftedness": http://is.gd/eSsLg.
12 hours ago: Interesting: "one page per book": http://openlibrary.org/about.
12 hours ago: Another after-work 8K, did 5K in 23:33, getting cooler here as #berlin #marathon approaches: http://is.gd/eSp95.
yesterday: C# CODE EXAMPLE: Extension method for checking regex in one line: http://is.gd/eQzyg.
yesterday: New podcast source: "I don't want to put you to sleep, but I want to be as rich, and rewarding, and resident as a dream.":http://is.gd/eQrdC.
yesterday: An intense colin marshall interview with michael silverblatt on the art of interviewing & more: http://is.gd/eQqve (search for "blatt").
yesterday: The stackexchange site for wordpress is up: get your answers / establish your reputation @cottonr http://wordpress.stackexchange.com.
2 days ago: "I've always felt that any time you can use a tuple, you should use a struct.": http://is.gd/eQm9V.
PRISM HOWTO created on Thursday, March 05, 2009 permalink
How to build a Silverlight application with Prism v2
This shows you how to build a Silverlight application with the Composite Application Guidance for WPF and Silverlight - February 2009 (http://www.microsoft.com/downloads/details.aspx?FamilyID=fa07e1ce-ca3f-4b9b-a21b-e3fa10d013dd&DisplayLang=en). It is a streamlined step-by-step that does the same as the Silverlight Hands-On Lab: Getting Started with the Composite Application Library in the PrismV2 documentation. Use it if you need to build the bases of a Silverlight Prism application quick. You can also download the code to get the finished solution. I used Microsoft Visual Web Developer 2008 Express Edition to create this.
Compile the .DLLs That You Will Need Later
  1. Go to the Prism V2 site (http://www.microsoft.com/downloads/details.aspx?FamilyID=fa07e1ce-ca3f-4b9b-a21b-e3fa10d013dd&DisplayLang=en) and download CompositeApplicationGuidance-Feb2009.exe, execute it, and specify to unpack it in c:\prismv2.
  2. Double-click the file c:\prismv2\Desktop & Silverlight - Open Composite Application Library.bat.
  3. Right-click on the folder Desktop and choose Build.
  4. In window explorer, go to C:\prismv2\CAL\Silverlight\Composite.UnityExtensions\bin\Debug and you should see all the .dll files that you will need later.
Create Basic WPF Application
  1. Create a new Silverlight application, called it HelloWorld.Silverlight.
  2. Make sure Add a new ASP.NET Web project to the solution to host Silverlight is checked.
  3. In windows explorer, got to solution folder, and created a new folder called Library.Silverlight.
  4. Go to C:\prismv2\CAL\Silverlight\Composite.UnityExtensions\bin\Debug again and copy all the .dll and .xml files to your Library.Desktop folder (the .xml files are so that you have intellisense on these libraries).
  5. In your project, add each of these .dll references by using the Browse tab.
  6. Rename Page.xaml to Shell.xaml.
  7. In Page.xaml.cs, click on Page and refactor/rename it.
Add Region To XAML
  1. Add this namespace: xmlns:Regions="clr-namespace:Microsoft.Practices.Composite.Presentation.Regions;assembly=Microsoft.Practices.Composite.Presentation".
  2. replace the Grid control with this:
    <ItemsControl Name="MainRegion" Regions:RegionManager.RegionName="MainRegion"/>
Add Bootstrapper, Etc.
  1. Add a class called Bootstrapper.cs to the HelloWorld.Silverlight project.
  2. replace the contents with:
    using System.Windows;
    using Microsoft.Practices.Composite.Modularity;
    using Microsoft.Practices.Composite.UnityExtensions;

    namespace HelloWorld.Silverlight
    {
        public class Bootstrapper : UnityBootstrapper
        {
            protected override DependencyObject CreateShell()
            {
                Shell shell = Container.Resolve<Shell>();
                Application.Current.RootVisual = shell;
                return shell;
            }

            protected override IModuleCatalog GetModuleCatalog()
            {
                ModuleCatalog catalog = new ModuleCatalog();
                return catalog;
            }

        }
    }
  3. open up App.xaml.cs and replace the Application_Startup method with this:
    private void Application_Startup(object sender, StartupEventArgs e)
    {
        Bootstrapper bootstrapper= new Bootstrapper();
        bootstrapper.Run();
    }
  4. Press F5 and you should get a blank web page but no errors.
Add a Module
  1. Right-click your solution and add a Silverlight Class Library named HelloWorldModule.
  2. add the following references (use the Browse tab):
    Microsoft.Practices.Composite.dll
    Microsoft.Practices.Composite.Presentation.dll
  3. Rename the Class1.cs file to HelloWorldModule.cs, respond yes that you want to rename all instances in the class itself as well.
  4. replace the content of this class with:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.Practices.Composite.Modularity;

    namespace HelloWorldModule
    {
        public class HelloWorldModule : IModule
        {
            public void Initialize()
            {

            }
        }
    }
  5. Add a Views folder to the HelloWorldModule project.
  6. In the HelloWorld.Silverlight project, add a reference to the HelloWorldModule (use the Projects tab).
  7. in the BootStrapper.cs file, replace the contents of the GetModuleCatalog() method with this:
                ModuleCatalog catalog = new ModuleCatalog()
                    .AddModule(typeof(HelloWorldModule.HelloWorldModule));
                return catalog;
  8. Compile your application again with F5 to make sure you typed everything in correctly.
Add a View
  1. Right-click on the Views folder, add new item, and add a Silverlight user control named HelloWorldView.
  2. add this inside the Grid tags in the HelloWorldView.xaml file:
            <TextBlock Text="Hello World"
                         Foreground="Green"
                         Margin="10"
                         FontSize="14"/>
Create a Region Manager
  1. open HelloWorldModule.cs and replace the content with this:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.Practices.Composite.Modularity;
    using Microsoft.Practices.Composite.Regions;

    namespace HelloWorldModule
    {
        public class HelloWorldModule : IModule
        {
            private readonly IRegionManager regionManager;

            //this is "constructor dependency injection", i.e. the regionManager is being injected into the module
            //because the module depends on it (since the regionManager will place it accordinly in the UI regions)
            public HelloWorldModule(IRegionManager regionManager)
            {
                this.regionManager = regionManager;
            }

            public void Initialize()
            {
                regionManager.RegisterViewWithRegion("MainRegion", typeof(Views.HelloWorldView));
            }

        }
    }
  2. Press F5 again and you will see your view display its content.