Martin Hinshelwood's Blog

A Scottish dyslexic software developer: Team System MVP, .NET architect, developer, evangelist, technology enthusiast and multi-dimensional free thinker


News

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.


Subscribe

Personal

Get Microsoft Silverlight

Accreditation

Stats

My Stats

  • Posts - 309
  • Comments - 362
  • Trackbacks - 128

Twitter












Tag Cloud


Recent Comments


Recent Posts


Article Categories


Archives


Post Categories


Image Galleries


Blogs I read


Blogs of Friends


Blogs on VSTS


Multi-Dimentional Free Thinking Bloggers


Personal


Projects


August 2008 Entries

Compatibility view in IE8


If you were worried about your pages viewing correctly in IE8 Beta 1 you had to restart your browser to enable "IE7 Compatibility mode". Now it is easy:

image

Although it seams to do a bit of detecting and only displays it on certain sites.

For example Microsoft.com and Google.com do not get the little button.

But Gmail does :)

posted @ Thursday, August 28, 2008 3:08 PM | Feedback (0) |


Cool new feature in IE8


It may be simple, and it may be small, but the feature that hit me first and greatest in IE8 was the address bar enhancements. This feature alone would have me upgrading:

image

This feature alone has improved my efficientcy :) I can find stuff again....

 

Technorati Tags: ,

posted @ Thursday, August 28, 2008 3:01 PM | Feedback (2) |


LINQ to XSD


Absolutely brilliant. That's what I think of Linq to XSD. Disappointed that is only works in C#, but having to use C# for a single project out of a solution it is a small price to pay to get the functionality.

If you install the LINQ to XSD Preview Alpha 0.2 Refresh you get a couple of extra project definitions:

image

If you create one of these it will have the features enabled. You can add the features to an existing project by editing the project definition file to add a property group:

   1: <PropertyGroup>
   2:   <TXLINQBinDir Condition="'$(TXLINQBinDir)' == ''">$(ProgramFiles)\LINQ to XSD Preview\Bin</TXLINQBinDir>
   3: </PropertyGroup>

And an import reference:

   1: <Import Project="$(TXLINQBinDir)\LinqToXsd.targets" />

note: if you are using MSBuild or Team Build you will need to install this add on there as well....

Now that you have a project, when you add an XSD you will have extra Build Actions available. Once you have set all of your XSD files to this Action and build, you will have classes for all of your XSD's. On down side is that it created a single file ("/obj/debug/LinqToXsdSource.cs"), bit it does work.

Technorati Tags: ,,

posted @ Thursday, August 28, 2008 2:48 PM | Feedback (0) |


Installing Internet Explorer 8 Beta 2


After I got my computer rebuilt (due to Problems with Team Explorer after installed Visual Studio 2008 SP1 RTM) I did not reinstall IE8 Beta 1 as I knew that Beta 2 was soon to be available.

Well, now it is:

As well as some guidance:

And some updates (Already! :) ) if you are using Real Player and Vista SP1:

Hopefully this install will go fine :)

Technorati Tags: ,

posted @ Thursday, August 28, 2008 10:02 AM | Feedback (0) |


Calling an object method in a data trigger


Calling a method on an instance of an object in WPF is not as easy to figure out, but with the help of this Internet thing I managed it.

Say you have a DataTemplate that renders a WorkItemType as a button that is selectable:

   1: <DataTemplate DataType="{x:Type tfswitc:WorkItemType}">
   2:     <DockPanel>
   3:         <Image DockPanel.Dock="Left" 
   4:                x:Name="wiImage" 
   5:                Width="16" 
   6:                Height="16" 
   7:                Source="pack://application:,,/Resources/Images/WorkItems/unknown.gif">
   8:         </Image>
   9:         <Button x:Name="wiButton" 
  10:                 Content="{Binding Name}" 
  11:                 Style="{DynamicResource WelcomeButtonStyle}" 
  12:                 CommandParameter="{Binding}" 
  13:                 Command="Controlers:TeamSystemCommands.ChangeWorkItemTypeCommand">
  14:         </Button>
  15:     </DockPanel>
  16: </DataTemplate>

Now, if I wanted to call a method on an instance of that WorkItemType and perform some action, then I would need a DataTrigger:

   1: <DataTemplate DataType="{x:Type tfswitc:WorkItemType}">
   2:     <DockPanel>
   3:         <Image DockPanel.Dock="Left" 
   4:                x:Name="wiImage" 
   5:                Width="16" 
   6:                Height="16" 
   7:                Source="pack://application:,,/Resources/Images/WorkItems/unknown.gif">
   8:         </Image>
   9:         <Button x:Name="wiButton" 
  10:                 Content="{Binding Name}" 
  11:                 Style="{DynamicResource WelcomeButtonStyle}" 
  12:                 CommandParameter="{Binding}" 
  13:                 Command="Controlers:TeamSystemCommands.ChangeWorkItemTypeCommand">
  14:         </Button>
  15:     </DockPanel>
  16:     <DataTemplate.Triggers>
  17:         <DataTrigger Value="False">
  18:             <DataTrigger.Binding>
  19:                 <Binding>
  20:                     <Binding.Source>
  21:                         <ObjectDataProvider ObjectType="{x:Type tfswitc:WorkItemType}" 
  22:                                             MethodName="SupportedByHeat" />
  23:                     </Binding.Source>
  24:                 </Binding>                        
  25:             </DataTrigger.Binding>
  26:             <Setter TargetName="wiButton" 
  27:                     Property="IsEnabled" 
  28:                     Value="False" />
  29:             <Setter TargetName="wiButton" 
  30:                     Property="ToolTip" 
  31:                     Value="You will need to add the 'HeatITSM.Ref' field to use this work item." />
  32:         </DataTrigger>
  33:     </DataTemplate.Triggers>
  34: </DataTemplate>

This will Call the method and if it returns false, it will disable the button and set a tooltip.

Now, this should work, but my SupportedByHeat method is an Extension method defined as:

   1: Imports Microsoft.TeamFoundation.WorkItemTracking.Client
   2:  
   3: Namespace TeamFoundationExtensions
   4:  
   5:  
   6:     Module WorkItemTypeExtensions
   7:  
   8:         <System.Runtime.CompilerServices.Extension()> _
   9:       Public Function SupportedByHeat(ByVal wit As WorkItemType) As Boolean
  10:             Dim c As Controlers.TeamSystemControler(Of MainWindow)
  11:             c = Application.ControlerFactory.GetControler(Of Controlers.TeamSystemControler(Of MainWindow))()
  12:             Return c.CheckWorkItemField(wit)
  13:         End Function
  14:  
  15:     End Module
  16:  
  17: End Namespace

And this does not seam to work even if I import the namespace in the XAML:

   1: <UserControl x:Class="SelectWorkItemType"
   2:   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   3:   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
   4:   xmlns:d="http://schemas.microsoft.com/expression/blend/2006" 
   5:   xmlns:tfs="clr-namespace:Microsoft.TeamFoundation.Client;assembly=Microsoft.TeamFoundation.Client"
   6:   xmlns:tfswitc="clr-namespace:Microsoft.TeamFoundation.WorkItemTracking.Client;assembly=Microsoft.TeamFoundation.WorkItemTracking.Client"    
   7:   xmlns:tfse="clr-namespace:Hinshelwood.TFSHeatITSM.TeamFoundationExtensions"
   8:   xmlns:local="clr-namespace:Hinshelwood.TFSHeatITSM"
   9:   xmlns:Controlers="clr-namespace:Hinshelwood.TFSHeatITSM.Controlers"
  10:   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  11:   mc:Ignorable="d">

The error message that is received is:

System.Windows.Data Error: 34 : ObjectDataProvider: Failure trying to invoke method on type; Method='SupportedByHeat'; Type='WorkItemType'; Error='No method was found with matching parameter signature.' MissingMethodException:'System.MissingMethodException: Method 'Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemType.SupportedByHeat' not found.
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
   at System.Windows.Data.ObjectDataProvider.InvokeMethodOnInstance(Exception& e)'

As you can see, during the binding the extension method is not evaluated.

During my investigation I came across that intoned that there is indeed some solution, but it is complicated requiring the use of Lambda expressions.

I am looking for an easy solution :)

posted @ Wednesday, August 27, 2008 11:16 AM | Feedback (0) |


WPF Threading


I was having a problem getting multi threading working with the ObservableCollection, and struggled to find a solution. So I asked my friend Google and after a while it directed me to Kevin's blog and specifically to his post on .

 

This is a fantastic article, that provided me with the exact solution I was looking for, so I perused his other articles and found many tips on Multi-Threading....

 

One to watch...

 

 

Technorati Tags: ,,

posted @ Wednesday, August 27, 2008 7:57 AM | Feedback (0) |


Heat ITSM


Heat ITSM LogoIn Aggreko we use a product called Heat ITSM to manage our support calls.  Now all of these calls are tracked using its tracking system, but we (Group Development) want to track using Team System. We need some way of moving and syncing items between these two systems.

TFS Heat ITSM start screen I completed the first part by using my TFS Event Handler project and that piece is live. If you put a field on any work item called "HeatITSM.Ref" and you fill it out (manually) with an ID from Heat then every time you change the work item it will update heat with a "Note" attached to that "Call". This was very easy using the TFS Event Handler model, but it still means that you need to create the Work Item manually.

The next step is to create a TFS Heat ITSM application that loads all the calls for a specific "Application" (category) and allows you to create a Work Item with a single click.

TFS Heat ITSM Work Item creation screen Well, I have been working on it, and the Codeplex site is up, and a initial Alfa application is there, but I an doing a refactor at the moment as things were getting a little complicated and confusing on the code side so a simplification was required.

As you can see from the screen shots I am using the TFS Sticky Buddy base code as a starting point and working from there, although during the refactor I am making a lot of changes that will benefit Sticky Buddy v2.0 as well.

Well, Back to the code face :)

posted @ Friday, August 22, 2008 8:35 AM | Feedback (0) |


What to do when you dont have a working computer!


I have a little problem...I don't have a computer at home at the moment :( So I am writing this post from my Pocket PC using Diarist 2. I will come back to that, but first...

The reason for my lack of my "can't live without accesory" is that my laptop has finaly given up the ghost. It is an 8 year old Dell desktop replacemnt, and in my infinite wisdom I desided to install Vista just after it went RTM. All was well for a while, but it was a litle slow. Add Visual Studio 2005 and things got a little slower...

It took aroung 3 months to sucessfuly get SP1 installed, yes I was one of those unfortinate users that had problems, and my laptop has never been the same since. For example, uninstalling VS2008 Beta and moving to the RTM took near enough 74 hours...Not good...

Well, it worked for a month and then started blue screening. Could be anything, but when I bit the bullet last night and desided to go back to XP I kept getting errors reading the disk which could on reflection be the disk, but I have a feeling that the hardware is toast...

So here I am writing this post on my phone and its not such a bad experience, although I have found that many sites talking about mobile software and devices don't actualy support viewing on a mobile device! What is that about...

I needed to look for some software to write this post, and obviously I found it, but it did require me to use most of the bits that an average person uses on a computer.
- Searching the internet
- Loading and reading web pages
- Downloading and instaling software
- Writing documents

On top of this, although I have never used it, I have a cut down version of Office 2007.

Taking allof this into acount I have found it a relatively painless experience, but I do accnowlage that I am not an average user and a terrible speller...

Now all I need is a version of Visual Studio 2008 and Team Explorer ;)

Technorati tags: ,

posted @ Saturday, August 16, 2008 10:14 PM | Feedback (1) |


If you had a choice!


I would be interested to find out what platform you .NET developers prefer to use as your main Visual Studio 2008 box?

 

  • XP
  • XP 64
  • Vista
  • Vista 64
  • Server 2008

 

Let me know!

posted @ Wednesday, August 13, 2008 12:16 PM | Feedback (7) |


Problems with Team Explorer after installed Visual Studio 2008 SP1 RTM


 

I received the following error box after installing VS2008 SP1 RTM:

image

 

Team Foundation Error

Could not load type ‘Microsoft.TeamFoundation.VersionControl.Controls.ItemsUpdatedExternallyEventArgs’ from assembly ‘Microsoft.TeamFoundation.VersionControl.Controls, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f57f11d50a3a

This stopped me accessing version control…a key part if you ask me.

The first thing I tried was to “Repair” Team Explorer, but that did not help, so I had a wee google…and found:

Problem of Team Explorer after installed Visual Studio 2008 SP1 beta which lead me to Re: Bug after installer the SP1 with work items and thus to the old favourite “reinstall the service pack!”

I have opened a thread (Problems with Team Explorer after installed Visual Studio 2008 SP1 RTM) on the MSDN forums…

If the reinstall of the SP fixes my problem, I will update there…

Update 2008-08-14: Nope, no fixie... I have sent my workstation to helpdesk for a rebuild. Humph!

Update 2008-08-15: I have installed SP1 sucessfully on 3 other computers.... Even ones that already had SP1 Beta1... Must just have been my workstation... double humph!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

posted @ Tuesday, August 12, 2008 4:30 PM | Feedback (2) |


Updating to Visual Studio 2008 SP1


If you have Visual Studio 2008 SP1 Beta installed make sure that you run the Visual Studio 2008 Service Pack Preparation Tool prior to the installation, Microsoft were trying to make this a seamless process, but on Heath Stewart's Blog he mentions that this was not possible in the end. The Preparation tool takes a while to run, but it is way better than having to uninstall everything :)

You will need your Visual Studio 2008 Install files when running the Preparation tool, but you should always keep the ISO handy any how…

A pure .NET 3.5 SP1 Betas install however (like out web servers) can just be updated by running the SP1 RTM install.

Required Downloads

Visual Studio 2008 Service Pack Preparation Tool

Microsoft Visual Studio 2008 Service Pack 1 RTM

Microsoft .NET Framework 3.5 Service Pack 1 RTM

 

posted @ Tuesday, August 12, 2008 1:40 PM | Feedback (0) |


Ooooh, RTM Delight


Well, MSDN will be busy today… Visual Studio 2008 Beta 1, Team Foundation Server 2008 Beta 1 and .NET Framework Beta 1 have all been released today. This is grate news as I have been using the Beta for about as long as it has been available and all those applications I have waiting in the wings can now go live :), Or at least get into the final phase of development.

Can you imaging a better data capture application than one that builds itself (ASP.NET Dynamic Data) or even a web service to expose your database to an application that you just tell it which bits of data you want to use (ADO.NET Data Services). How about the ability to create a conceptual model of your data from multiple databases that hides your application from database schema changes (ADO.NET Entity Framework). That's just in the ASP.NET and ADO bags, not to mention the WPF performance improvements and the ClickOnce improved install process as well as being able to customise said process and the ability to deploy application with a cut down version of the .NET Framework that has a smaller footprint (20mb as opposed to 60mb) and have the full framework streamed down over time with BITS.

The .NET Framework 3.5 SP1 and Visual Studio 2008 SP1 has improvements and optimisation's across the board…A good day for developers and users alike.

There are tones of performance and minor improvements in Team Foundation Server as well…

 

posted @ Tuesday, August 12, 2008 6:52 AM | Feedback (0) |


.NET Service Manager


A while a go I create a Service Manager. A way of wrapping local and remote services (widgets, bits, things) for use in any application within your business or just in your own code…

I made the source available before, but as I am now going to be using and updating it again, I have created a Codeplex Project for it and put it up on my own site and called it .NET Service Manager.

You can download the source code, and in a very short while I will have a first release up…

 

It is quite simple, but has a plethora of uses… One of the best is creating Client side API’s for web services and components of applications…

.NET Service Manager

posted @ Wednesday, August 06, 2008 2:23 PM | Feedback (0) |


IHandlerFactory


As you have probably noticed I have moved URL’s (sorry to all you feed readers with the duplicate entries). The reason I moved my blog was to free up the http://hinshelwood.com URL for use as a personal site that then links to my blog. When you do this you need to consider all of your current users, bookmarks, feeds, links and all that malarkey.

So, I created a WebRedirect (thanks to DynDNS.org) that means that all hinshelwood.com traffic is automatically redirected to blog.hinshelwood.com including all of the sub pages. This is fine until I actually put up a site on hinshelwood.com and brake all of the links… HttpHandler to the rescue…

The first step was to create a “BlogRedirectHandler” to redirect all of those pesky URL’s to the new site.

Imports System.Text.RegularExpressions
Imports System.Web

Namespace Core.Handlers

    Public Class BlogRedirectHandler
        Implements IHttpHandler

        Private Shared m_Patterns() As String = {"/archive/*", _
                                                 "/Tag/*/default.aspx", _
                                                 "/category/*"}

        Public Shared Function IsValidToRun(ByVal context As System.Web.HttpContext, _
                                            ByVal requestType As String, _
                                            ByVal virtualPath As String, _
                                            ByVal path As String) As Boolean
            For Each p In m_Patterns
                If Regex.IsMatch(context.Request.Url.ToString, p) Then Return True
            Next
            Return False
        End Function

        Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
            Get
                Return True
            End Get
        End Property

        Public Sub ProcessRequest(ByVal context As System.Web.HttpContext) Implements IHttpHandler.ProcessRequest
            Dim oldurl As String = context.Request.Url.ToString
            If oldurl.Contains("/archive/") Then
                Dim newurl As String = "http://blog.hinshelwood.com" & context.Request.Url.AbsolutePath
                context.Response.StatusCode = System.Net.HttpStatusCode.MovedPermanently ' permanent HTTP 301
                context.Response.RedirectLocation = newurl
                context.Response.StatusDescription = "Moved Permanently"
                context.Response.ContentType = "text/html"
                context.Response.Write("<html><head><title>Object Moved</title></head><body>")
                context.Response.Write("<h2>Object moved to <a href=\" & newurl & " \>here</a>.</h2>")
                context.Response.Write("</body></html>")
                context.Response.End()
            End If

        End Sub

    End Class

End Namespace

This little piece of code has two important pieces, the “IsValidToRun” which makes sure that we need to run it, and the “ProcessRequest” method that does the actual dog work of the redirect.

I have chosen to use a “MovedPermanently“ status so that the search engines will catch on more quickly and the new URL should quite quickly replace the old.

If we just added this handler to the web application we would loose all of our .aspx pages and only see a blank page for those that are not valid for this handler.

To handle this the easiest way is to inherit from the existing “PageHandlerFactory” that is the default in ASP.NET.

Imports System.Web

Namespace Core.Handlers

    Public Class CustomPageHandlerFactory
        Inherits PageHandlerFactory

        Public Overrides Function GetHandler(ByVal context As System.Web.HttpContext, _
                                             ByVal requestType As String, _
                                             ByVal virtualPath As String, _
                                             ByVal path As String) As IHttpHandler
            If BlogRedirectHandler.IsValidToRun(context, requestType, virtualPath, path) Then
                Return New BlogRedirectHandler
            Else
                Return MyBase.GetHandler(context, requestType, virtualPath, path)
            End If
        End Function
    End Class

End Namespace

Then all we need to do is call our IsValidToRun method and either run the base (default) GetHandler or return our new handler…

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

posted @ Tuesday, August 05, 2008 10:11 AM | Feedback (0) |


Hosted Sticky Buddy


I now have a nice hosted version of the TFS Sticky Buddy that is fairly fast and deploys using ClickOnce, but you do need to make sure that you already have .NET 3.5 and Team Explorer 2008 installed first…

 

 

Technorati Tags: ,,

posted @ Monday, August 04, 2008 1:57 PM | Feedback (3) |