Most of you guys don’t know what a spectral library is and I forgive ye. But I needed something to test this brand new thing. So I choose something I know and something I know is hard to find.
But this is all about the new VB10. So I started of by downloading the also new Windows 7 RC and VS2010 beta 1. I installed windows 7 on a Virtual machine for Virtual PC.
I already had some code for VS2008 and I used that to start. I will be uploading the whole thin gin the near future.
I will use the following frameworks.
Short brief for the project: Open spectrum files and save them in a database or export them to another file. Show the spectrum on the screen in a graph. Do this for the following type MSP, FT-IR and Raman spectrometer results. Do some basic manipulation on the spectra.
All three types are different. and have there own set of rules.
But lets move on.
I open the VS2008/Framework 3.5 solution in VS2010 and the same import wizard shows up as we had it in VS2008 so click finish and be done with it.
It then goes on to open my solution in the VS2010 format (I guess) and I get the first errors.
It seems as though it can’t find System.Windows.Forms.DataVisualization but I’m sure I read somewhere that this is now part of the 4.0 framework. So I guess like VS2008 VS2010 keeps the framework your project was compiled for. Time to change that.
Right-click on the project pick Properties, pick Compile, blah blah, jada jada, see picture.
We change the framework to 4.0 and voila there we have it the first problem solved everything is now ready to go for us. Lets see if it runs.
and it does.
Next step was to test those lambda expressions.
I had this in VB9 to configure structuremap.
```vbnet Public Shared Sub Initialize() StructureMap.ObjectFactory.Configure(Function(x) Configure(x)) End Sub
Private Shared Function Configure(ByVal x As StructureMap.ConfigurationExpression) As Boolean
x.ForRequestedType(Of Forms.Interfaces.IMain).AsSingletons.TheDefault.Is.OfConcreteType(Of Forms.Main)()
x.ForRequestedType(Of Forms.Interfaces.IMsp).TheDefault.Is.OfConcreteType(Of Forms.Msp)()
x.ForRequestedType(Of Controllers.Interfaces.INavigation).TheDefault.Is.OfConcreteType(Of Controllers.Navigation)()
x.SetAllProperties(Function(y) SetTheProperties(y))
End Function
Private Shared Function SetTheProperties(ByVal y As StructureMap.Configuration.DSL.SetterConvention) As Boolean
y.OfType(Of Forms.Interfaces.IMain)()
y.OfType(Of Forms.Interfaces.IMsp)()
Return True
End Function```
And yes we can now do this.
```vbnet Public Shared Sub Initialize() StructureMap.ObjectFactory.Configure(Sub(x) x.ForRequestedType(Of Forms.Interfaces.IMain).AsSingletons.TheDefault.Is.OfConcreteType(Of Forms.Main)() x.ForRequestedType(Of Forms.Interfaces.IMsp).TheDefault.Is.OfConcreteType(Of Forms.Msp)() x.ForRequestedType(Of Controllers.Interfaces.INavigation).TheDefault.Is.OfConcreteType(Of Controllers.Navigation)()
x.SetAllProperties(Sub(y)
y.OfType(Of Forms.Interfaces.IMain)()
y.OfType(Of Forms.Interfaces.IMsp)()
End Sub)
End Sub)
End Sub```
Woohoo. Let’s make that VS2009 shall we ;-).