Adding WPF and WCF to VS2005

Microsoft as I have said before are not very good at writing installers.
They have a tendancy to ignore possible futures and always test for exact current versions.

This is the case when you try and add the WPF and WCF addons to VS2005.

Here
is an article on how to make it work once you have installed service pack 1 for .NET 3.0

The idiot who wrote the installer tested for the presense of the uninstall option for the initial version of .NET 3.0, ignoring the possibility of a service pack.

This is not the first time I have seen a microsoft installer perform this stupidity.
Back in the day I learnt a lot about the registry configuration for COM objects the hard way.
The 16 bit version of VB installed a common library.   Subsequently this library had a 32 bit version released too.
If you installed the 16 bit version over the 32 bit one it clobbered the registry sufficiently to break the later version.
Rather inconsiderately the application suite that I was assisting used both versions…
I had to write a patch utility to correct this problem.  COM always had a technique for handling this kind of versioning problem but it was clear that whoever wrote the installer did not understand this.

Improved wpf demo

Here is an improved version of the wpf demo.  The older posts build script still applies.

I need to attribute this site for giving me hints to go in the right direction.

import System

import System.Windows

import System.Windows.Controls

import System.Windows.Navigation

  

class Exer1(NavigationWindow):

            para as TextBlock

            button as Button

           

            def constructor():

                        para = TextBlock(Text:”Hello World!!!”, FontSize:36)

                        para.VerticalAlignment = VerticalAlignment.Center

                        para.HorizontalAlignment =HorizontalAlignment.Center  

                        # create a button


//<![CDATA[

//]]>
                        button = Button(Content:”Click Me”, Height:30, Width:100)

                        # display the textblock when the button is clicked

                        button.Click += NavButtonClick

                        # display the button first

                        Navigate(button)

                       

            protected def NavButtonClick(sender as object, e as RoutedEventArgs):

                        Navigate(para)

                                   

                       

[STAThread]

def Main():

            app = Application()        

            Exer1().Show()

            app.Run()

Boo and WPF

Here is an example of Boo and WPF.
I am not claiming that it is origonal since it was cribbed from someone elses site.
However this version is not broken and does have a build script.

The following is wpdemo.boo:

namespace Boo.WinFx
import System
import System.Windows
import System.Windows.Controls
import System.Windows.Navigation

[STAThread]
def Main():
    # create a window host
    win = NavigationWindow()   
    # create a textblock
    para = TextBlock(Text:”Hello World!!!”, FontSize:36)
    para.VerticalAlignment = VerticalAlignment.Center
    para.HorizontalAlignment =HorizontalAlignment.Center   
    # create a button
    button = Button(Content:”Click Me”, Height:30, Width:100)
    # display the textblock when the button is clicked
    button.Click += { win.Navigate(para) }
    # display the button first
    win.Navigate(button)
    # create an application host
    app = Application()
    # show the window
    win.Show()
    # fire the application
    app.Run()

The following is default.build:

<?xml version=”1.0″ ?>

<project name=”wpfdemo” default=”build”>
<property name=”boo.dir” value=”C:/boo/bin” />
    <target name=”build” depends=”wpfdemo” />
    <target name=”wpfdemo”>
        <loadtasks assembly=”${boo.dir}/Boo.NAnt.Tasks.dll” />
                 <booc output=”wpfdemo.exe” target=”winexe”>
            <references>
                <include name=”C:/Program Files/Reference Assemblies/Microsoft/Framework/v3.0/*.dll” />
            </references>
            <sources>
                <include name=”wpfdemo.boo” />
            </sources>
        </booc>
    </target>
</project>