I am usually skeptical about a lot of things I read. I have the attitude of prove it to me. Another saying of mine is “if it sounds too good to be true, it probably isn’t.” The other day I was getting ready for a demo for a prospective client. I was developing 4 views along with a main windows and a navigator bar. It was a typical business app in Silverlight. I wanted to show the client what I could do for him. The app looked great. Basically you could move from one view to another, connect to a database and display some data in a grid and on a few dialog boxes. Nothing fancy, just enough for a proof of concept. I did the application using Intersoft Client UI 5 and IdeaBlade DevForce 6.1.1. Did I mention that it was in Silverlight?
Well the morning of the demo, I was speaking to my contact in the IT department, and he mentioned something about the company using Citrix ahd how they run their applications over Citrix in a browser. Uh-oh, how did I get the impression that the client wanted Silverlight and a web app when what he probagly really wanted was a n-tier app using WPF. Sometimes I hear what I want to hear when someone is talking to me. Now I was in a jam I was going to demo a Silverlight app when I really wanted to be demoing a WPF app. I probably could have facked the demo by running the Silverlight demo in a browser, but I didn’t want to chance screwing anything up.
What was I to do? The demo was several hours away. Then I remembered that I was using Client UI 5 and one of Intersoft’s biggest selling points was that the controls worked the same in either WPF or Silverlight and both provided built-in MVVM framework support. I created a new project, this time I selected the WPF libraries for both Client UI and DevForce. I then copied my entity framework into the new project. I rebuilt it. It compiled fine. I then created folders in my application for my Views, ViewModels, ModelServices, Helpers, Assets etc. I copied all the .xaml and .cs and .png files into the new project. I held my breath and compiled. Darn, I had something like 100 errors. Fortunately they were simple ones to fix. I corrected my namespaces with the correct new name and my using statements. I recompiled. Now I was down to tem errors. I found another problem. It was my navigateURI in my MainPage.xaml, In the Silverlight version, my navigateURI was set to “/CustomerListView and there was no problem, but in WPF I have prefix the /CustomerListView with /Views/CustomerListView because my views were in a subdirectory to MainPage.xaml. Hmmm. I will have to ask Jimmy Petrus at Intersoft about that one. I recompiled and now I had only four errors left. Well these were my fault, I had set up partial classes for my DomainModel classes to add Validation routines having to do with IdeaBlade’s validation features. I added the validation to my DomainModel project classes, deleted the partial classes, and recompiled. No Errors!!! Now I ran the program and there was my main window showing the home page. I clicked on each icon in the navigator bar and it moved to the right view and displayed data. It worked.
I was able to take a Silverlight application and with minimal corrections, move it to WPF in under an hour. What Intersoft had advertised they had certainly devivered on. That leads to all kinds of possibilites. I have an application which I was converting to Silveriight from VB 6 that is used by Unions all over the country. Now I could have an N-tier version of it also and not have to do a lot of work to achieve this capability.
Maybe one day Microsoft will merge the distant cousins Silverlight and WPF, and there won’t be the differences between them. But until then there is always Intersoft.