Get list of installed applications

For those of you that are lazy and are required to provide a list of installed applications. Here is something i knocked together that is a good starting point Download InstalledApps exe – gets a list of installed apps. Assumes you have .NET 3.5 installed.

Its pretty bare bones but note you can pipe the output into a text file using the command prompt and typing

InstalledApps.exe > test.txt


Enterprise patterns from the trenches. The Sydney Architecture User Group

The next meeting of The Sydney Architecture User Group – SAUG is on soon. Definitely worth attending, details follow:

Title: Enterprise Patterns from the trenches Presenter Omar Besiso
Date/Time: Thursday 22/04/2010 06:00 PM
Where: Grace Hotel , Kiralee or Pinaroo Function Room 77 York st Sydney,NSW. 2000

Enterprise Applications, Enterprise Software, Enterprise Architects, Enterprise Enterprise Enterprise. What’s it all about? The Architecture User Group is proud to explain and clarify the hype. Over the next two meetings we will be having sessions to talk about what Enterprise Software is and Enterprise patterns from the trenches. Following on from this, next month’s meeting will see Paul Glavich continue with the Enterprise Architecture theme but from a web application perspective.

Presenter Bio
Omar has been a coder since he can remember! BASIC, PASCAL, COBOL, JAVA, .NET and alien languages unknown to human kind. From being a Computer Science student to Microsoft’s .NET ambassador to .NET consultant and then Enterprise Architect at Datacom, Omar has enjoyed every step of the journey one line of code at a time. Omar has worked through ASP.NET, Windows Forms, WPF, SharePoint, BizTalk, TFS and CRM projects and considers himself a Microsoft technologies veteran. He was also a speaker at TechEd events and various other MS events and user groups in Sydney, Adelaide, Brisbane, Cairo and Dubai. Omar enjoys working across multiple projects at once and his motto is “Power to the Developers”. He spends his day throwing more architectural tasks on fellow architect Paul Glavich instead of doing it himself. If you want to annoy him just say web applications are better than rich client ones.

Paul Glavich Microsoft MVP releases free e-book .NET Performance Testing and Optimization The Complete Guide

Paul Glavich Microsoft MVP sent a link to his free e-book around this morning.

“My book on performance testing, profiling and optimisation has been officially released and is available as a free download (eBook)! I think the hardcopy version will be available on amazon as a paid version.”

.NET Performance Testing and Optimization

The chapter list is:

Chapter 01: Introduction – The What and the Why
Chapter 02: Understanding Performance Targets
Chapter 03: Performance and Load Test Metrics
Chapter 04: Implementing your Test Rig
Chapter 05: Creating Performance Tests
Chapter 06: Next Steps – Profiling
Chapter 07: Performance Profiling
Chapter 08: Memory Profiling
Chapter 09: The Performance Testing Process
Chapter 10: Common Areas for Performance Improvement
Chapter 11: Load Balancing
Chapter 12: Internet Information Server (IIS)
Chapter 13: HTTP Optimization

Remember to support the hard of Paul and Chris by buying a copy of the hardcopy from Amazon

Implementing MVVM for the first time on Windows Phone 7 using Silverlight for Mobile

This post is my first attempt at implementing the MVVM pattern on Windows Phone 7 using Silverlight for Mobile.
Prior to reading this post you should read Silverlight for Mobile on Windows Phone 7 InkPresenter Fun as a reference point for context and contrast.

  1. The MainPageViewModel is added for MainPage.   Key points to note are:
    • MainPageViewModel inherits from DependencyObject
    • Strokes is a DependencyProperty
    • Functionality from event handlers of MainPage moved into MainPageViewModel
    • No current use of Dispatcher as currently no separate thread attempting to update UI thread.
     public class MainPageViewModel : DependencyObject
            private StrokeCollection _strokes;
            private Stack<Stroke> _removedStrokes = new Stack<Stroke>();
            private Stroke _currentStroke;
            public MainPageViewModel()
                Strokes = new StrokeCollection();
            public StrokeCollection Strokes
                get { return (StrokeCollection)GetValue(StrokesProperty); }
                set { SetValue(StrokesProperty, value); }
            // Using a DependencyProperty as the backing store for Strokes.  This enables animation, styling, binding, etc...
            public static readonly DependencyProperty StrokesProperty =
                DependencyProperty.Register("Strokes", typeof(StrokeCollection), typeof(MainPageViewModel), new PropertyMetadata(null));
            public void BeginCapture(Point point)
                _currentStroke = new Stroke();
                _currentStroke.DrawingAttributes.Color = Colors.Blue;
            public void CaptureStrokePoint(Point point)
                if (_currentStroke != null)
            public void EndCapture()
                _currentStroke = null;
            private StylusPoint GetStylusPoint(Point position)
                return new StylusPoint(position.X, position.Y);
            public void Undo()
                if (Strokes != null && Strokes.Count > 0)
                    Strokes.RemoveAt(Strokes.Count - 1);
            public void Redo()
                if (_removedStrokes != null && _removedStrokes.Count > 0)
  2. The MainPage code behind now becomes as follows.  Important points to note are:
    • The Datacontext is now set to an instance of MainPageViewModel i.e _vm; 
    • The _vm is called within each event handler to manipulate the view.
    public partial class MainPage : PhoneApplicationPage
            private MainPageViewModel _vm;
            public MainPage()
                SupportedOrientations = SupportedPageOrientation.Portrait | SupportedPageOrientation.Landscape;
                _vm = new MainPageViewModel();
                this.DataContext = _vm;
                inkTest.MouseMove += new MouseEventHandler(inkTest_MouseMove);
                inkTest.MouseLeftButtonDown += new MouseButtonEventHandler(inkTest_MouseLeftButtonDown);
                inkTest.MouseLeftButtonUp += new MouseButtonEventHandler(inkTest_MouseLeftButtonUp);
            private void inkTest_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
            private void inkTest_MouseMove(object sender, MouseEventArgs e)
            private void inkTest_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
            private void btnUndo_Click(object sender, EventArgs e)
            private void btnRedo_Click(object sender, EventArgs e)
  3. The MainPage XAML now becomes as follows: Its important to note that:
    • InkPresenter Now binds Strokes
             <Grid x:Name="ContentGrid" Grid.Row="1">
                <InkPresenter Name="inkTest" Strokes="{Binding Strokes}" Background="White" Height="652" VerticalAlignment="Top" />
            <shell:ApplicationBar Visible="True" IsMenuEnabled="True">
                    <shell:ApplicationBarIconButton x:Name="btnUndo" IconUri="/Images/dark/" Click="btnUndo_Click"></shell:ApplicationBarIconButton>
                    <shell:ApplicationBarIconButton x:Name="btnRedo" IconUri="/Images/dark/" Click="btnRedo_Click"></shell:ApplicationBarIconButton>

This implementation is now easier to write unit tests against then its predecessor.  One thing I am not happy with is the lack of use of Command and ICommand to route all commands to the MainPageViewModel using bindings.  I noticed that although ICommand exists in silverlight for mobile the Button, ApplicationBarIconButton and InkPresenter dont support the command property.  Initial thoughts would be to create a derived class e.g for ApplicationBarIconButton to provide a Command property but it seems like it is a lot of effort for little gain.  Anyone out there know if the Command prop and bindings will be supported on the user controls in Silverlight for Mobile?

Adding an Application Bar to your Windows Phone 7 application

This example uses my previous InkPresenter example to add an Application Bar to replace the undo and redo buttons with two ApplicationBarIconButton.  I also add MenuItems to the application bar for illustrative purposes.  As yet they serve no functional purpose.
  1. Add a reference to “Microsoft.Phone.Shell”
  2. In your page Add a namespace declaration with prefix of shell:
  3.  xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone.Shell"
  4. Add images to your project either and ensure that you set the Copy to Output Directory as Always and Build Action as Content
  5. Add your application bar
  6.     <phoneNavigation:PhoneApplicationPage.ApplicationBar>
            <shell:ApplicationBar Visible="True" IsMenuEnabled="True">
                    <shell:ApplicationBarIconButton x:Name="btnUndo" IconUri="/Images/light/" Click="btnUndo_Click"></shell:ApplicationBarIconButton>
                    <shell:ApplicationBarIconButton x:Name="btnRedo" IconUri="/Images/light/" Click="btnRedo_Click" ></shell:ApplicationBarIconButton>
                    <shell:ApplicationBarMenuItem x:Name="mnuItemX" Text="Menu Item X"></shell:ApplicationBarMenuItem>
                    <shell:ApplicationBarMenuItem x:Name="mnuItemY" Text="Menu Item Y"></shell:ApplicationBarMenuItem>
  7. Wire up the event handlers
  8.         private void btnUndo_Click(object sender, EventArgs e)
            private void btnRedo_Click(object sender, EventArgs e)
  9. Results
Before using ApplicationBar

Before using ApplicationBarAfter WP7 ApplicationBar Collapsed

After WP7 ApplicationBar Collapsed

After WP7 ApplicationBar Collapsed

After WP7 ApplicationBar Expanded

After WP7 ApplicationBar Expanded

 Some useful resources for the Application Bar are as follows:

  • Application Bar Icons for Windows Phone 7 Series
  • Application Bar Best Practices for Windows Phone
  • Windows Phone 7 NotificationChannelOpenException with MS Push Notification HttpNotificationChannel.Open

    Issue: Had a NotificationChannelOpenException today when testing out MS Push Notifications  for Windows Phone 7 using code as follows.

                HttpNotificationChannel _channel = new HttpNotificationChannel("NickTest");      �
                {             �
                    _channel.ChannelUriUpdated += new EventHandler&lt;NotificationChannelUriEventArgs&gt;(channel_ChannelUriUpdated);
                    _channel.HttpNotificationReceived += new EventHandler&lt;HttpNotificationEventArgs&gt;(channel_HttpNotificationReceived);
                    _channel.ShellEntryPointNotificationReceived += new EventHandler&lt;NotificationEventArgs&gt;(channel_ShellEntryPointNotificationReceived);
                    _channel.ShellNotificationReceived += new EventHandler&lt;NotificationEventArgs&gt;(channel_ShellNotificationReceived);
                    _channel.ExceptionOccurred += new EventHandler&lt;NotificationChannelExceptionEventArgs&gt;(channel_ExceptionOccurred);
                    _channel.Open(); //Error occurs here
                    //_channel.BindToShellEntryPoint(); // tile�
                    _channel.BindToShellNotification(); // - toast
                catch (NotificationChannelExistsException)
                    _channel = HttpNotificationChannel.Find(_channelName);

    Exception stack dump was as follows when calling Open on the _channel:

    Microsoft.Phone.Notification.NotificationChannelOpenException was unhandled
           at Microsoft.Phone.Notification.SafeNativeMethods.ThrowExceptionFromHResult(Int32 hr, Exception defaultException)
           at Microsoft.Phone.Notification.HttpNotificationChannel.Open()
           at MyStrokes.Provider.NotificationProvider.Subscribe()
           at MyStrokes.App.Application_Startup(Object sender, StartupEventArgs e)
           at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
           at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

    Solution:  If you try to Open a channel almost immediately after you hit Debug when emulator fires up this issue will occur.  The solution is simple – Give the emulator two minutes before making the call. 

    It appears this is a documented issue in the Windows Phone 7 Developer Tools CTP Release Notes:

  • The push client debugging has to wait for two minutes after boot of the emulator (or device) before using the APIs (i.e. Start screen show up).
  • For push notifications, if the emulator host computer is behind a proxy, SOCKS proxy has to be configured on the host computer.You can go to Control Panel > Network and Internet > Internet Options > Connections tab, and then choose the Setting option to set this configuration. //Also thought this was useful

    Cellular Emulator – “There are not seven pairs of XPVCOM in system”

    Issue: The Cellular Emulator
    C:\Program Files (x86)\Windows Mobile 6 SDK\Tools\Cellular Emulator

    installed with the Windows Mobile 6 SDK does not work on a 64bit OS.  When running the application it gives an Error “There are not seven pairs of XPVCOM in system”. 

    Solution: The only work around for the moment seems to be installing a VM with running a 32bit OS. 

    If I come across a better solution or hear that an update has been released for 64bit machines I will post it here.