After looking at the BaseDALObject and tracing its usage, I’ve come to the conclusion that at the moment, it is too intertwined to refactor. I will leave it as is with its simple code cleanup and try a different angle.
So I decided to run the application. And kaboom! No go. So I think I will just start from the top down.
Wow, I completely forgot that back in the day we didn’t have the awesomeness of partial classes. So my main form has a bunch of generated controls etc from the designer. So I am going to create a new MainForm and let VS do its magic joo joo. And actually since I have to create a new form anyway, I am going to create a WPF application.
Step 1 – Create a new WPF project called RMS
Step 2 – Move all the WinForm controls over
When I tried to compile after fixing some minor issues. I got this error message
The issue is my MainForm still has a ‘main’ method. The new WPF application project has the main method in the App.xaml.cs
Remove this and we should be good to go.
The project already has a MainWindow and it is opened up by the application on startup. How do I know? I can just look at the App.xaml and the StartupUri.
So now time to start moving over the actual code and controls for the MainForm.
File > Quit
Manage Data > Manage Datasets, Manage Other Data
Analysis > Analyze Rate Schedules
To recreate this in WPF we simply do:
Change layout controls
Based on the naming of the controls and my recollection. I had a left side and a main panel. And looks like a splitter between the two panels. In WPF we can do this all within a grid control.
Now time to swap out change the code where some other controls are added to the panels.
We just need to wrap up the form controls in WindowsFormsHost controls and add them to the stackpanels.
Now I can compile. But when I run, I blow up. Looks like I need to take a look at the RMS Controller. But that can wait for another day.