Archive

Archive for the ‘Uncategorized’ Category

The rumours of my demise have been exaggerated.

April 9, 2012 1 comment

So, I haven’t been very active on this blog for quite a while and you would be forgiven for thinking that I’d given up on it. This couldn’t be further from the truth – it’s just that I’ve been a busy little bee for the last few months.

So what have I been doing that has kept me away from finding time to blog? Well, I’ve been working with the inestimable Sacha Barber on a project called CodeStash. CodeStash is an online snippet manager which allows you to take snippets directly from Visual Studio via an addin, and save them online. OK, so that doesn’t sound too exciting, but CodeStash goes much further. You can group the snippets together, so that you can have related snippets grouped together (why just have a piece of XAML when you can have the styling and the code behind in there).

We have big plans for CodeStash, and have managed to hook up with those wonderful people at CodeProject to host this service. Go on, hop on over to the site and sign up; download the extension and contribute your snippets for the betterment of mankind; well, those people who will be cool enough to appreciate your awesome logic. Best of all; this service is free.

Categories: Uncategorized

MoXAML goes Codeplex

September 15, 2011 1 comment

One of the commonest questions I’ve been asked about MoXAML was whether or not I would be maintaining it in a repository of some description. While I’ve not been against the idea, I just haven’t got around to doing it. Well, that is I hadn’t got around to doing it. I am pleased to announce that MoXAML is now open source and is available on CodePlex at http://moxaml.codeplex.com/.

By putting MoXAML on CodePlex, it is going to be easier for me to maintain the whole setup/installation package and I’m toying with an idea on how to automatically pull down updates to MoXAML – these are architectural ideas only, no code has been written, it’s just notes and diagrams so far.

Anyway, sorry for not posting something “witty” or silly – this post’s relatively normal for me. Abnormal service will resume shortly.

Categories: Uncategorized

It’s time to dock with the mothership

August 17, 2011 Leave a comment

It seems that the many headed Hydra that is VS Live is coming round again in October, and it’s bigger and better than ever. If you thought it was good before, you haven’t seen anything yet.

While I can’t promise that attending it will make you more successful with members of whichever sex you prefer, I can tell you that some of my favourite speakers are going to be there. Rachel Appel will be delivering talks on creating data driven web sites with WebMatrix and Razor, a dive into how Orchard CMS works and will finish off with a high dive off Microsoft 1 into a thimble containing an inch of water.

If you think that’s impressive, Pete Brown will be delivering a whole host of XAMLicious goodness and rumour has it that he will do this tied up in chains, dangling upside down in a big box of water, wearing nothing other than a goose-fat thong. You owe it to yourself to get along to the Redmond mothership and catch these outstanding talks, and a whole lot more.

Disclaimer: Some of this shizzle is made up, but the bit about the great speakers and the topics they’ll be talking about is 100% straight up.

Categories: Uncategorized Tags:

So where do we go from here?

June 3, 2011 46 comments

Well, Microsoft has finally unveiled what is commonly known as Windows 8. If you have been learning Kung Fu in a secret Tibetan monastery or yak fishing off the coast of Antarctica, you may have missed the announcements this week and the blizzard of opinion and talking heads pronouncements. To some it’s the death knell of Windows, to others it’s a brave and bold move. Whatever your take, one thing is clear, the Metro UI represents a dramatic step forward for Windows applications.

First of all, let me make it clear that the Metro UI is not the only UI that you can use in Windows. It’s a great choice for Tablets, and if you’ve used a Windows Phone, you’ll know just how useful it really is (I love my Live Tiles), but if you want to use a non touch UI you still have the Aero interface to provide that familiar gooey goodness. What the new version of Windows represents is a step out to other processors and technologies; a move beyond Wintel, and this has to be good news for all concerned. As a developer, the exciting thing is that I should be able to write software that targets tablets, phones and PCs all from the same environment.

Let me clear something else up. Despite what you may think you have heard, Microsoft is not abandoning all other languages and technologies in favour of HTML 5 and JavaScript. Yes, this represents an important plank in Microsoft’s strategy to write once run-anywhere, and have applications run in the cloud. I was one heck of an HTML 5 sceptic, but having looked into HTML 5 and WCF vNext, I can’t believe just how good developing for it can be in the MS stack – I will be writing more on this in the future; take it from me, you’re going to love it. The thing is, though, while this is great in webby, cloudy environments, HTML apps just don’t mut the custard in desktop environments, or in applications where you really don’t want your IP exposed. This is why I’m excited about the future of technologies like .NET, Silverlight, WPF and C++. Microsoft has made a huge investment in .NET and XAML, and it seems incredibly unlikely that they will alienate virtually their entire developer ecosystem – and rumour has it that Win C++ is going to have a big impact in Windows 8.

Indeed, Microsoft’s biggest problem still seems to be that it isn’t communicating this information effectively. They get so excited about all the new stuff that’s coming, they don’t mention the existing stuff; after all, why should they? They assume that people realise that they aren’t cutting their own noses off, and forget that people remember the history of failed tech. Let me assure you, from conversations I’ve had, and from talking to those in the know, your technological investment is safe. Your apps may look different in the future, and respond to different inputs, so you may need to learn some new APIs, but that should excite you, not frighten you.

Finally, let me quote the great Jeremiah Morrill:

“Anyways, why is everyone so surprised about the annoucement?  People have been saying this was going to be a feature of Win8 for at least 5 or 6 months ;)

I think it’s important to remember what Ballmer said in his Swiss keynote.  That Win8 applications can be written using, C++, C# and JS.  He was very careful to NOT mention a framework, only languages.  Now there are is a lot of “Will it run Silverlight?” or “Will it run WPF?”.  Microsoft will respond with “Yeah, its Windows”.  This is true.  They did demo Win8 also running “traditional” applications.

I think we should be asking:  What technologies can I use to make these new immersive Win8 applications?

The other question I would ask, mostly to devs is, “Does this new thing perform better than Silverlight/WPF at making fluid user interfaces?”  If so, besides backwards compatibility, what advantages does Silverlight/WPF have over this new thing?  Will Silverlight (or WPF) still be an island of richness, or an island of relative choppiness and CPU tax?

One thing I can say for certain, is XAML is part of Microsoft DNA.  They have promised us our investment in XAML is safe, over and over.  What I’m not certain about is, what is our investment defined as?  Knowledge/familiarity or our actual code?  Will there be a solid upgrade path, or will we be left dumping old code?  My advice is we should all be patient until Sept.  There’s just too many questions that cannot be answered with a Win8 demo that wasn’t geared for devs.”

Possibly the wisest words you’ll hear on the subject.

Categories: Uncategorized

Well Bipply-flipply. More VS Live

March 11, 2011 Leave a comment

All round good guy and guru of gurus, the lurv god of cod himself, Mr Walt Ritscher will be presenting three talks at VS Live, one on the Tuesday and two on Thursday:

http://vslive.com/Events/Spring-2011/Sessions/Tuesday/T1-Easing-in-to-Windows-Phone-7-Development.aspx

http://vslive.com/Events/Spring-2011/Sessions/Thursday/TH4-Digging-Deeper-in-Windows-Phone-7.aspx

http://vslive.com/Events/Spring-2011/Sessions/Thursday/TH5-XAML-Primer-Clarifying-the-UI-Markup-Language.aspx

If Walt can make them then you owe it to yourself to as well. Go on, see this giant of the development world in action – it’s true, he really is a giant; he’s 8 foot 6.

Categories: Uncategorized

This is me kissing MVPship goodbye forever

March 5, 2011 7 comments

So, I posted a question a couple of days ago asking those who’d been to the MVP summit this week whether or not a feature I requested on the vNext request was being developed. Now, I got jumped up and down on in that question because the MVPs have been slapped this year with NDAs up the wahoo, and they are all too scared to talk about what they’ve learned – I like and respect these guys a lot, but the response on the thread was a little bit OTT in my opinion.

Now, the point of this blog post. I think Microsoft have gone too far with this whole NDA thing. While I understand that they have commercial confidences that they need to keep from the competition, but not everything that they cover in the summit will be so secret that the wider world can’t be told about it. This brings me to the point – Microsoft in the past has relied on the MVPs to be the advocates of the up and coming releases, they are the front line in evangelising the technologies that Microsoft have come up with.  When a product reaches a certain level of maturity, the whole product evangelist thing stops as an official marketing tool for Microsoft. At this point, the reliance on MVPs to act as the funnel of information out to the development community becomes more important.

Now, with the use of the NDA creating an effective barrier to this, Microsoft has just hamstrung their key marketing frontline from preparing the wider public and getting them excited about what’s coming. (BTW – this is in reaction to an MVP last year letting the cat out of the bag on upcoming features that were genuinely NDAd – leading to this knee-jerk blanket NDA). Bear in mind that Microsoft has suffered some embarrassing marketing SNAFUs over the last few months (way to go Muglia), you’d think that it would want all the help that it can get, but apparently this is not so.

Off topic slightly: Microsoft, WPF is the best development framework you have ever produced. Don’t dilute and dumb it down, or even run it down. Improve it and continue to see how it can be innovated, and you will find the take up increases. Initially WPF was such a step change that people were scared off it, but now they are more exposed to it thanks in no small part to your MVPs, that takeup is increasing – ironically at just the point you’ve lost interest in it.

Now, the amazing comment was that they couldn’t even discuss what was said with other MVPs from the same discipline who weren’t able to attend. I’m sorry Microsoft, but you’ve lost the plot here. You need to stop being so insular and actually start communicating with people – you could take a leaf from Apple’s book here and start to get a better marketing campaign going.

Well, I had to get my frustration off my chest here. In the last few weeks, I’ve heard a real company line from the guys and girls inside the Redmond ivory tower. The thing that has become markedly apparent is that they don’t get how their decisions affect those of us in the wider world. With every bit of marketing foul-up and crossed wires, they can negatively affect entire companies – and they just don’t get it; and this is incredibly frustrating.

Oh well, I guess this post has just kicked any chances of getting nominated for MVP into touch and, you know what, I don’t care? I am too old to put up with the crap I heard this week and I am now, officially going to take a look at what other platforms can give me and my company.

What the hell. Nobody reads my ramblings anyway, and Microsoft certainly don’t care about small business owners, so if you do happen to stumble across this; please help, I’m a prisoner in a jam factory. It will be interesting to see if any of my compatriots on the Disciples read my blog – if they do, this post should stir things up.

Categories: Uncategorized

Well scupper me sideways and butter me with kippers.

Right, now that I got your attention with that rather bizarre title, I’d like to bring your attention to the forthcoming VS Live event in Las Vegas. The Early Bird registration ends on 23rd March, and if you register by then you should save $200 – good value in my book (available at all good retailers if I’d bothered to write it). Register here.

Visual Studio Live is the ideal opportunity for you to meet some of the Microsoft dev team and MVP rock stars. Press them hard enough and they should treat you to some amazing deep dive coding sessions, and if they don’t, don’t forget to tie their hair in a bun and call them Ethel.

Sample sessions include DotNetMaster’s Billy Hollis and the ever magnetic Rocky Lhotka (don’t take your harddrive too near to him), presenting a day workshop on April 18th. This session, “Making Effective Use Of Silverlight And WPF”, should be a good one and promotes two of my favourite topics – don’t forget to attend. Rocky also presents another subsession about another of my favourite topics, as if you can’t tell what that one is; it’s the exciting sounding “Leveraging the MVVM Pattern in Silverlight, WPF and Windows Phone”. Find out more about these and other wonderful sessions here.

Categories: Uncategorized Tags:

You’d better watch out, there’s a Disciple about.

May 23, 2010 5 comments

Today WPF Disciple all round good egg and nice guy Mr Josh Smith entered the twilight zone where he found out that he didn’t know as much as he thought he did and he should read an article that somebody called Josh Smith wrote. I really don’t know how he didn’t slap them round the face with a wet kipper. Here’s his take on the subject:

‘Something hilarious just happened…Just a few minutes ago I went to one of Seattle’s numerous coffeehouses to get breakfast.  While waiting in line, the two guys in front of me (looked like coworkers) are talking, and I overhear them use the term “ViewModel.”  When their conversation comes to a lull, I politely ask if they’re talking about MVVM.  The following conversation ensued, between one of the guys and myself:

Guy: “Yes, we are actually.”
Me: “Oh cool, that’s a great pattern.  Always an interesting topic.”
Guy: “We use it all the time.”
Me: “What do you like about it?”
Guy: “I like that it’s based on dependency injection.  That makes it really easy to test ViewModels.”
Me: “What do you mean that it’s based on DI?”
Guy: “I mean, it’s based on DI.  Have you ever actually used the pattern?”  [Guy2 now smirks pretentiously]
Me: “Yes, I’ve used it.  But, to me, it’s based on Models, Views, and ViewModels.  That’s it, no DI.”
Guy: “Well it sounds like you don’t really get it then.  It’s complicated, so you need to read a lot about it.”
Me: “Oh, that’s good to know.  What do you suggest I read to learn about it?”
Guy: “Start with Josh Smith’s MVVM article in MSDN Magazine.”
I kid you not.  That is literally what the guy told me.  I burst out laughing so loud that I felt embarrassed and had to leave.  The guy must have thought I was psychotic!

I seriously hope they read this and reflect how close they were to greatness.

Categories: Uncategorized

It’s not that hard to add the missing bits to Silverlight.

July 19, 2009 12 comments

Recently, my good friend Josh Smith announced that he was putting together a set of MVVM foundation classes. In typical Josh fashion, these classes are hyper useful and hyper clever, and represent some of the great classes he’s produced over the last couple of years to help with MVVM.

Most of these classes work straight out of the box in both WPF and Silverlight, but there is a fly in the ointment. Josh recently developed a class to observe objects that implement INotifyPropertyChanged and it’s seriously good; and it’s virtually totally useless in Silverlight due to Silverlight not supporting the underlying mechanism that is used in the monitoring; the PropertyChangedEventManager class. Now, in a lesser framework than .NET, I’d be worried – but .NET gives us so much freedom to add in the missing functionality, and I wouldn’t be a WPF Disciple if I didn’t like to tinker.

Before I go any further, I will say that there is an alternative implementation in the Silverlight Toolkit in the WeakEventListener. The problem with this class (I use the word problem advisedly here) is that it requires you to use lambda expressions. It also meant that the class that Josh put together would have to be modified, so I decided to see how hard it would be to put together an implementation of PropertyChangedEventManager that works in Silverlight.

As I was working to a well defined feature set (i.e. it only had to work with the functionality in Josh’s class), I didn’t have to recreate the total functionality in the underlying framework classes. I did want it to work with the weak event pattern, however, so without further ado – here’s the functionality in Silverlight.

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Collections.Generic;

namespace System.Windows
{
  /// <summary>
  /// Provides an implementation so that you can use the
  /// "weak event listener" pattern to attach listeners
  /// for the <see cref="PropertyChanged" /> event.
  /// </summary>
  public class PropertyChangedEventManager
  {
    #region Members
    private Dictionary<string, List<WeakReference>> _list;
    private static object SyncLock = new object();
    private static PropertyChangedEventManager _manager = null;
    #endregion

    #region Public methods
    /// <summary>
    /// Adds the specified listener to the list of listeners on the specified source.
    /// </summary>
    ///
<param name="source">The object with the event.</param>
    ///
<param name="listener">The object to add as a listener.</param>
    ///
<param name="propertyName">The name of the property that exists on
    /// source upon which to listen for changes.</param>
    public static void AddListener(INotifyPropertyChanged source,
      IWeakEventListener listener,
      string propertyName)
    {
      Instance.PrivateAddListener(source, listener, propertyName);
    }

    /// <summary>
    /// Removes the specified listener from the list of listeners on the
    /// specified source.
    /// </summary>
    ///
<param name="source">The object with the event.</param>
    ///
<param name="listener">The object to remove as a listener.</param>
    ///
<param name="propertyName">The name of the property that exists
    /// on source upon which to listen for changes.</param>
    public static void RemoveListener(INotifyPropertyChanged source,
      IWeakEventListener listener,
      string propertyName)
    {
      Instance.PrivateRemoveListener(source, listener, propertyName);
    }
    #endregion

    /// <summary>
    /// Get the current instance of <see cref="PropertyChangedEventManager"/>
    /// </summary>
    private static PropertyChangedEventManager Instance
    {
      get
      {
        if (_manager == null)
          _manager = new PropertyChangedEventManager();
        return _manager;
      }
    }

    /// <summary>
    /// Begin listening for the <see cref="PropertyChanged"/> event on
    /// the provided source.
    /// </summary>
    ///
<param name="source">The object on which to start listening
    /// for <see cref="PropertyChanged"/>.</param>
    private void StartListening(INotifyPropertyChanged source)
    {
      source.PropertyChanged += new PropertyChangedEventHandler(this.PropertyChanged);
    }

    /// <summary>
    /// Stop listening for the <see cref="PropertyChanged"/> event on the
    /// provided source.
    /// </summary>
    ///
<param name="source">The object on which to start listening for
    /// <see cref="PropertyChanged"/>.</param>
    private void StopListening(INotifyPropertyChanged source)
    {
      source.PropertyChanged -= new PropertyChangedEventHandler(this.PropertyChanged);
    }

    /// <summary>
    /// The method that handles the <see cref="INotifyPropertyChanged.PropertyChanged"/> event.
    /// </summary>
    ///
<param name="sender">The source of the event.</param>
    ///
<param name="args">A <see cref="PropertyChangedEventArgs"/> that
    /// contains the event data.</param>
    private void PropertyChanged(object sender, PropertyChangedEventArgs args)
    {
      List<WeakReference> list = _list[args.PropertyName];
      if (list != null)
      {
        // We have the listeners. Deal with them
        foreach (WeakReference item in list)
        {
          IWeakEventListener eventItem = item.Target as IWeakEventListener;
          if (eventItem != null && item.IsAlive)
          {
            eventItem.ReceiveWeakEvent(this.GetType(), sender, args);
          }
        }
      }
    }

    /// <summary>
    /// Private method to add the specified listener to the list of listeners
    /// on the specified source.
    /// </summary>
    ///
<param name="source">The object with the event.</param>
    ///
<param name="listener">The object to add as a listener.</param>
    ///
<param name="propertyName">The name of the property that exists
    /// on source upon which to listen for changes.</param>
    private void PrivateAddListener(INotifyPropertyChanged source,
      IWeakEventListener listener,
      string propertyName)
    {
      if (_list == null)
      {
        _list = new Dictionary<string, List<WeakReference>>();
      }

      lock (SyncLock)
      {
        WeakReference reference = new WeakReference(listener);
        if (_list.ContainsKey(propertyName))
        {
          _list[propertyName].Add(reference);
        }
        else
        {
          List<WeakReference> list = new List<WeakReference>();
          list.Add(reference);
          _list.Add(propertyName, list);
        }
        // Now, start listening to source
        StartListening(source);
      }
    }

    /// <summary>
    /// Private method to remove the specified listener from the list of listeners
    /// on the specified source.
    /// </summary>
    ///
<param name="source">The object with the event.</param>
    ///
<param name="listener">The object to remove as a listener.</param>
    ///
<param name="propertyName">The name of the property that exists on
    /// source upon which to listen for changes.</param>
    private void PrivateRemoveListener(INotifyPropertyChanged source,
      IWeakEventListener listener,
      string propertyName)
    {
      if (_list != null)
      {
        lock (SyncLock)
        {
          if (_list.ContainsKey(propertyName))
          {
            // Stop responding to changes
            StopListening(source);
            // Remove the item from the list.
            WeakReference reference = null;
            foreach (WeakReference item in _list[propertyName])
            {
              if (item.Target.Equals(listener))
              {
                reference = item;
              }
            }
            if (reference != null)
            {
              _list[propertyName].Remove(reference);
            }
          }
        }
      }
    }
  }
}

The only thing that’s missing is the weak event listener interface (IWeakEventListener):

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace System.Windows
{
  /// <summary>
  /// Provides event listening support for classes that expect to receive events
  /// through the WeakEvent pattern and a WeakEventManager.
  /// </summary>
  public interface IWeakEventListener
  {
    /// <summary>
    /// Receives events from the centralized event manager.
    /// </summary>
    ///
<param name="managerType">The type of the WeakEventManager calling this method.</param>
    ///
<param name="sender">Object that originated the event.</param>
    ///
<param name="e">Event data.</param>
    /// <returns>true if the listener handled the event. It is considered an error by the
    /// WeakEventManager handling in WPF to register a listener for an event that the
    /// listener does not handle. Regardless, the method should return false if it receives
    /// an event that it does not recognize or handle.
    /// </returns>
    bool ReceiveWeakEvent(Type managerType, object sender, EventArgs e);
  }
}

That’s it – that’s all you need to add in to add the “missing” functionality. Simple, isn’t it?

You can download the source here. Note that you’ll have to rename the file from .doc to .zip before you can decompress it.

A CodeProject MVP again.

January 5, 2009 Leave a comment

My good friend, Mr Karl Shifflett, just let me know that I’ve been awarded CodeProject MVP status for a second year. I’m so proud, and it’s good to see that so much ground has been made up of the WPF Disciples here.

Thanks to Chris and the CP community – it’s been a blast guys and gals.

Categories: Uncategorized
Follow

Get every new post delivered to your Inbox.

Join 40 other followers