To Every Thing There Is a Season

October 21, 2011

When someone leads with a quote from Ecclesiastes 3.1, you know some sort of change is about to be announced.

Friday, 28 Oct 2011 will be my last day in Redmond, and unfortunately Microsoft and the patterns & practices team.

My decision to leave Redmond was driven solely by the poor real estate market in this area. I really want to build a new home, but know too many people here who are upside down (big $$$$) in their mortgages or who short sold their home. This was not a risk I wanted to take. Some say the market is near the bottom and now is a good time to buy here; maybe, but the cost to build a new home is higher than I want to take on and a long or hard commute is not an option for me. I prefer a 10-15 minute traffic-free drive (doesn’t everyone?)

This was a very difficult decision choosing between a life goal of building a new home, a short commute, and trying to stay with Microsoft in Redmond.

On 29 Oct 2011, I’ll be moving to Boise, Idaho and after a short break will begin a new career with Gayle Manufacturing Company. I’m looking forward to becoming part of the GMC family and transitioning back to an architect-developer role. Over the winter I’ll work with a home builder in Boise and hope to break ground in March or April of 2012. The other night I was studying home automation; it felt good to look forward to building a home, something I have not felt in long time.

Leaving Microsoft

Leaving Redmond is easy (for the above reason), leaving Microsoft is difficult. I’m grateful for the opportunities I’ve been given over the last 3 years. Except for the Marine Corps, Microsoft is the best company I’ve ever worked for. I would not hesitate to recommend the opportunities at Microsoft to anyone, this super place to work.

I will very much miss the dedicated and very smart people at Microsoft.

Leaving Redmond also means moving away from friends in the area; I will miss you as well.

Staying Connected

My blog will continue with WPF, Prism, and enterprise development topics, and will venture into WinRT land as well. I’m looking forward to joining the user groups in Boise.

I will also continue to stay close with Microsoft teams and groups by participating on advisory boards and other customer channels.

Close

Microsoft and the people of Microsoft, thank you very much for the last three years.

Have a great day,

Just a grain of sand on the worlds beaches.


Windows Phone 7 Market Place Test Kit

October 10, 2011

I’m starting a new project at work today to deliver MVVM guidance for the Windows Phone 7. This is going to be similar to the In the Box MVVM Training I did in Dec 2010.

One tool I’ll be using is the new Windows Phone Marketplace Test Kit.

From the above MSDN page:

The Windows Phone Marketplace Test Kit provides a suite of automated, monitored, and manual tests to help prepare your applications to be accepted in the Marketplace the first time you submit them. The test kit enables you to identify and fix issues prior to Marketplace submission, which saves time in the submission process. You can use the test kit to evaluate applications that target Windows Phone OS 7.1 or later.

To open the Marketplace Test Kit, select your Windows Phone 7.1 project in the Solution Explorer. Then from the Project menu select, Open Marketplace Test Kit.

MarkplaceTestKit

The below tool will open allowing you to run a set of prepackaged tests and provides a UI to import the required images for your application.

MarkplaceTestKittwo

Thanks go out to the Windows Phone team for shipping this.

Have a great day,

Just a grain of sand on the worlds beaches.


Released: Project Silk Client-Side Web Development for Modern Browsers

September 18, 2011

The Microsoft patterns & practices team is excited to announce the release of Project Silk.

Project Silk

Client-Side Web Development for Modern Browsers

Project Silk provides guidance for building maintainable cross-browser web applications that are characterized by an intentional design, rich interactivity, and a responsive user interface (UI). The result is an immersive and engaging user experience (UX). Such applications take advantage of the latest web standards, including HTML5, CSS3, and ECMAScript version 5, and modern web technologies such as jQuery and ASP.NET MVC 3.

The concepts explained in this book are demonstrated via a real-world customer-facing web application called the Mileage Stats Reference Implementation (Mileage Stats). Mileage Stats allows users to track and compare their vehicles’ fuel efficiency, usage, and operating costs, and to schedule vehicle maintenance reminders. The image below shows the Mileage Stats client-side objects and their implementation mapped to libraries or frameworks.

SilkArch

Building a rich web application that reduces the number of full-page loads, includes animations, and is responsible for updating the UI dynamically requires a thoughtful approach to managing structure, modularity, communication, navigation, and data. The book details how the Project Silk team designed Mileage Stats and solved a number of challenges.

Links
Audience
  • This guidance is intended for web developers and assumes you have some hands-on experience with ASP.NET MVC, CSS, HTML, JavaScript, and jQuery.
In this Release
  • Project Silk Mileage Stats Reference Implementation full source code
  • Widget QuickStart documentation and source code
  • Unit Test Hands on Labs (3)
  • Project Silk: Client-Side Web Development for Modern Browsers online documentation
  • Mileage Stats Video
About patterns & practices

The Microsoft patterns & practices team provides a wide range of guidance to help customers save time and reduce risk on their software development projects by incorporating proven patterns and practices.  This applied engineering guidance includes both production quality source code and in-depth documentation.

The guidance is designed to help software development teams:

  • Make critical design and technology selection decisions by highlighting the appropriate solution architectures, technologies, and Microsoft products for common scenarios
  • Understand the most important concepts needed for success by explaining the relevant patterns and prescribing the important practices
  • Get started with a proven code base by providing thoroughly tested software and source code that embodies the recommendations

For more information: http://msdn.microsoft.com/practices

Have a great day,

Just a grain of sand on the worlds beaches.


Windows 8 Gives New Life to Older Hardware

September 18, 2011

Like most of you, I’ve been wonderfully surprised by the Microsoft BUILD conference this last week. The delivered software and presentations to help us get started with Windows 8 far exceeded any expectations I had.

To try and add anything to what has been clearly communicated would be foolish on my part.  Instead let me tell you about my “Lazarus” experience this week.

I’ve been eyeing the Asus EP121 for several weeks now. I got to play with one at the Bellevue Microsoft Store. This is one sweet unit.

Well, I have a dusty, HP tm2 TouchSmart Laptop/Tablet. It has a Core i3 1.2ghz, 4GB memory, integrated graphics card, slow 5400rpm drive. My thinking was, if I can pull a Lazarus on this computer for 6-12 months, I’ll save myself the $1,000 now and wait for the next generation hardware and with fast CPU, SSD, HD screen, etc.

I did use the HP tm2 for Window Phone 7 development and OneNote note taking.  It was kind of slow, especially compared to other modern hardware.

The slowness was not attributed to Windows 7, but rather to lame hardware. 

PC hardware manufacturers please start making decent hardware that competes with Apple’s hardware and PLEASE stop putting crapware on my new PC. All crapware should be a line item, opt-in.

I need to move off this topic before I go into a tirade.

On the good side, one of the keynotes at BUILD showed new hardware coming soon that looks like the MacBook Air, metal, thin, etc.  At last. Please offer good components in your units, I’ll pay for them.

So I replaced the first generation 5,400rpm hard drive with a 7,200 second generation SATA. Was getting just a little excited, breathing new life into my laptop.

Lazarus!

Following simple directions on Scott Hanselman’s blog, I loaded the Win8 Preview on a USB.

When I booted the laptop I change the default boot to the USB so I could install Windows.  When Windows restarts, don’t forget to change the default boot back to your hard drive.

Installation took 12 minutes; Windows, Visual Studio, demo applications, etc.  Core i3 and a decent disk, still respectable.

The laptop boots very quickly, applications are responsive and fun to use.  I have not installed Office yet, but will soon. For now, just learning to get around Windows 8 and how to write Metro XAML apps.

Scud Missile

After I logged in, I ran Windows Update and one of the items installed was the, “Microsoft IntelliPoint 8.2 Mouse Software for Windows – 64 bit” This update on my laptop caused the touch to quick working.  So I used Add Remove programs to uninstall it, rebooted and got touch working again.

Visual Studio XAML Designer Patch

You need to install a patch published by the Expression Team to correct a mouse issue with the designer.

https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=38599

After downloading, don’t forget to “Unblock” the .zip file.  The instructions left this out.

You MUST follow the installation instructions, most important you must install the patch as an administrator.

The fun part will be trying to figure out how to open an Administrator Command Prompt. I could not figure out how to do this using the Metro interface.  So… I opened Windows Explorer in the Desktop, navigated to the \Windows\system32 folder, right-clicked on the cmd.exe file and selected, “Run as Administrator.” While you at it, go ahead and pin that Administrator Command Window to the TaskBar, problem solved.

Getting Around Windows 8

Since you probably won’t be writing code using your TouchScreen keyboard, you’ll want to get up to speed on Windows Shortcuts. The following blog post is being recommended by several on Twitter so I’ve included it here as well.

http://www.winrumors.com/windows-8-tips-and-tricks-for-mousekeyboard-users/

Before Your Frist Project

Before you dive into your first Metro project, take time and watch some of the BUILD videos. If you only watch one video, watch this one: http://channel9.msdn.com/events/BUILD/BUILD2011/BPS-1004. Jensen Harris clearly explains Metro and the thinking behind it. He is also one of the best presenters at BUILD and connects with the audience and viewers alike.

Video

The below video shows my HP tm2 after the Lazarus operation.  Short, 3 minutes gives you a good feel for how a Core i3 runs Windows 8.

http://www.vimeo.com/29222402

Close

These are good times for Windows developers.

For me, I’m finishing up my WPF/Prism BBQ Shack program and will move the cash register and online purchasing modules to Metro.  Metro is perfect for a touch screen cash register.  This will be so much fun to write.

Have a great day,

Just a grain of sand on the worlds beaches.


Seattle GiveCamp Oct 21-23 2011 in Redmond

September 8, 2011

Give camps are a great way for developers, designers, and database administrators to give back to non-profit organizations, and to have a very fun weekend too!

All the details and sign up for the Redmond GiveCamp can be read here:  http://seattlegivecamp.com/

What I like about weekend events like this is the challenge:

  • Working with a team you may have never met
  • Writing an application you have zero up front context on
  • Delivering over the weekend an application that will be deployed and used the next week

For this event, I’ll be joining a group of of Microsoft LightSwitch team members to take up the challenge of delivering an application using LightSwitch over the weekend.

This is a great opportunity for you to meet others, exercise your skills on a team, learn from other team members and have fun at the same time.

If you find yourself in Redmond in October, we hope to see you there.

Don’t forget you need to sign up here: http://seattlegivecamp.com/

Have a great day,

Just a grain of sand on the worlds beaches.


Simplifying Prism WPF Navigation – Synchronous Navigation Confirmation

September 5, 2011

Microsoft patterns & practices Prism 4 library and guidance gives WPF and Silverlight developers a very solid foundation for creating business applications. Adopting Prism patterns and library features guides the developer towards creating applications that: can evolve over time, are not tightly coupled, can be independently developed across a large team, are Blendable, and testable.

New to Prism 4 was the Navigation API’s. The use of the Navigation API’s greatly simplifies application development because the Navigation API takes over the responsibility of object creation and siting objects in the target region.

The Prism library is designed to support applications that can target WPF and Silverlight with good code reuse. While not all developers need this capability, a lot of thought and design decisions were made to fully support this scenario.

One API that took this capability into account while being designed is the Navigation API; specifically the confirmation of a navigation request. Objects that implement IConfirmNavigationRequest have the option to veto a navigation request. In order to support the limitation that Silverlight does not allow blocking dialog boxes, the IConfirmNavigationRequest.ConfirmNavigationRequest method had to be written so that Silverlight objects could participate in vetoing a navigation request without a blocking dialog.

Without going into all the details (you can read them here), objects that implement IConfirmNavigationRequest are required to invoke the callback in the ConfirmNavigationRequest method arguments. Objects are free to implement any vetoing code they want as long as the callback is invoked.  In practice the navigation request is halted until the callback is invoked. This design enables Silverlight developers to implement a variety UI solutions for prompting the user, for example the Prism Interaction Request.

I’ve found that I’m my WPF development that I had to jump through the above hoops just to have navigation confirmation, when in fact WPF has out of the box support for modal, UI blocking dialogs. In an effort to simplify my WPF applications I’ve created a replacement for the Prism RegionNavigationService that allows for synchronous navigation confirmation.

The implementation is very straightforward and only requires that you add one class and one interface to the Prism library and recompile it.

The RegionNavigationSynchronousService is the replacement for the stock RegionNavigationService. This class uses the new synchronous (blocking) navigation confirmation interface IConfirmNavigationRequestSynchronous, listed below.

public interface IConfirmNavigationRequestSynchronous : INavigationAware
{
    /// <summary>
    /// Determines whether this instance approves being navigated away from.
    /// </summary>
    /// <param name="navigationContext">The navigation context.</param>
    Boolean ConfirmNavigationRequestSynchronous(NavigationContext navigationContext);
}

By default, Prism automatically registers the RegionNavigationService in the container as part of the bootstrapping pipeline. However, we want to use the WPF friendly synchronous confirmation service, RegionNavigationSynchronousService.

All that is required is to override the ConfigureContainer method in your bootstrapper and register RegionNavigationSynchronousService as I’ve done below.

namespace TestBench {
    using System.Windows;
    using Microsoft.Practices.Prism.Modularity;
    using Microsoft.Practices.Prism.Regions;
    using Microsoft.Practices.Prism.UnityExtensions;
    using Microsoft.Practices.Unity;
    using TestBench.Customers;

    class Bootstrapper : UnityBootstrapper {
        protected override IModuleCatalog CreateModuleCatalog() {
            var catalog = new ModuleCatalog();
            catalog.AddModule(typeof (CustomersModule));
            return catalog;
        }

        protected override DependencyObject CreateShell() {
            var shell = this.Container.Resolve<ShellView>();
            Application.Current.MainWindow = shell;
            Application.Current.MainWindow.Show();
            return shell;
        }

        protected override void ConfigureContainer() {
            base.ConfigureContainer();

            // register the new navigation service that uses synchronous navigation
            // confirmation instead of the async confirmation.
            this.Container.RegisterType(typeof(IRegionNavigationService),
                typeof(RegionNavigationSynchronousService));
        }
    }
}

Below is a very simple implementation.

PLEASE do not put MessageBox code in your view models!  This is for demo purposes only and to keep the code simple.  Please use a dialog service that abstracts the UI dialog away from the view model.

The below code is from the included download and is in the CustomerMaintenanceViewModel. The below ConfirmNavigation property allows the demo to confirm or not but is not part of the Navigation API. This method returns true or false to continue the navigation request or not.

public Boolean ConfirmNavigationRequestSynchronous(NavigationContext navigationContext) {
    if (this.ConfirmNavigation) {
        if (MessageBox.Show("Close form and navigate?", "Confirm Navigation",
            MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK) {
            return true;
        }
        return false;
    }
    return true;
}

Demo Application

SyncDemo

Very simple Prism application that demonstrates confirming navigation requests and region lifetime. The status bar indicates the views in the ContentRegion on the right.  As you open or close views their name will be displayed; for the Customers, the customer number will be displayed.

Crack the code open, you’ll have this down in a few minutes.

Download

As always, don’t forget to “Unblock” the zip file after downloading from the Internet before you unzip it.

Synchronous Prism Navigation (177KB)

The download includes a sample Prism solution that your can run without modifying your Prism library code.  I’ve included a \Lib folder in the solution with pre-built, modified Prism library code.

I’ve also included two files in the \PrismSource folder that you can add to your Prism library. Simply copy these two files into the below folder and recompile Prism. You now have the option to use a simpler navigation confirmation API in your WPF projects. 

This only works in WPF and NOT Silverlight.  If you have the requirement to share code between WPF and Silverlight this will not work because Silverlight requires the navigation confirmation to be async.

SyncNav

Have a great day,

Just a grain of sand on the worlds beaches.


Windows Phone 7 – Seattle Silverlight User Group Meeting Code

August 4, 2011

On 8/3/2011 I did a presentation for the Seattle Silverlight Users Group called, “A Slice of Mango – Data Forms.”

This presentation was on data forms for Windows Phone 7.

The MangoForms demo application consists of a series of forms that each focus on a single aspect of a form such as, scrollability, type mismatch exceptions, validation, ICommands, IDataErrorInfo, sample data, design-time tooling, MVVM, etc.

I’ll try and publish a few videos that capture the teaching presented at the meeting.

Download

You can download the code and deck from my Sky Drive here.

Note:  The deck is in the folder SiliconValleyCodeCamp and is for the Application Life Cycle training.  There is no deck for this presentation, just code.

Have a great day,

Just a grain of sand on the worlds beaches.


Follow

Get every new post delivered to your Inbox.

Join 139 other followers