We have a requirement of converting our WinForm smart client desktop application to WPF browser application (XBAP).
As we are using Smart Client architecture (Smart Client Software Factory - Guidance Package), we don't have control over form creation and display. So we used following approach:
We overridden Start method of WindowsFormsApplication class which runs the Shell form. But this leads to another problem of form being disposed. CabApplication.Run method internally calls Start method and then disposes the form, once it is closed. As we are
not displaying the form in Start method, it directly goes to dispose.
To overcome this, we have commented dispose call from Run method in SCSF framework and handled in application. We are not sure if making a change in framework is a good idea but it worked for us.
To get the Shell object in XBAP application, we created a method in WinForm application, which returns the Form object. We also used an event in AfterShellCreated to notify XBAP application about Shell creation.
With all these changes, we are able to host smart client in WPF browser based application.
Can anyone review the approach and tell us, if there is any better way of doing this, without making any change in framework classes??