[SOLVED] Questions about porting Windows Forms to Wisej

Answered Closed
0
0

Since Wisej controls extend Windows Forms controls, the namespace System.Windows.Forms is about always present. So one must use a generous amount of type aliasing. Furthermore there are two relevant Wisej namespaces Wisej.Web and Wisej.Data.

I presume we must use Wisej types over Windows Forms equivalents. I have a using section that goes like this

Snippet

using Wisej.Web;
using Binding = Wisej.Data.Binding;
using BindingCompleteContext = Wisej.Data.BindingCompleteContext;
using BindingCompleteState = Wisej.Data.BindingCompleteState;
using BindingSource = Wisej.Data.BindingSource;
 
using Component = Wisej.Web.Component;
 
using BindingCompleteEventArgs = System.Windows.Forms.BindingCompleteEventArgs;
using BindingsCollection = System.Windows.Forms.BindingsCollection;
using ICurrencyManagerProvider = System.Windows.Forms.ICurrencyManagerProvider;

Pretty strange…

And I found some problems. One of them is due to the fact that System.Windows.Forms.BindingCompleteEventArgs has no equivalent on Wisej.Data. As the event handler needs to use the event arguments, I must cast each one to the equivalent Wisej.Data type.

After all that, I’m not even sure whether it will work. You got the picture: inferno.

I attach the first version and the final version.

P. S. – This component BindingSourceRefresh addresses a binding issue introduced in .NET 2.0 that Microsoft never solved. I’ll make a specific post about the later issue.

  • You must to post comments
Best Answer
0
0

The reference has to be there. We create a real windows control in design mode to have a designable surface to render (paint) the html into. At runtime we don’t create it and use the base winforms ScrollableControl as a POCO component.

I meant the namespace should be removed everywhere. But of course, as you pointed out, if you use those data binding classes it’s not possible until we remove the inheritance that I mentioned before.

Best,

Luca

  • You must to post comments
0
0

Hi Luca,

You mean remove the System.Windows.Forms reference from the project? Right now you need it at least for 3 reasons:

  • System.Windows.Forms.BindingCompleteEventArgs
  • System.Windows.Forms.BindingsCollection
  • System.Windows.Forms.ICurrencyManagerProvider

I’m used to convert Windows Forms projects to VWG. I prefer to develop on Windows Forms and port it to VWG. The porting is really quite easy. I expect it will be as easy to port to Wisej as it is to port to VWG.

The fix for the DataBinding bug is part of CSLA .NET. This framework’s license changed to MIT early this year so Wisej can re-use the code at will.

  • You must to post comments
0
0

Hi Tiago,

The problem is from the base WinForms.Binding. I see the issue you are referring to and will remove the WinForms.Binding completely from the base. It was just convenient/fast to extend. Send me also additional information about  the Microsoft bug please, I’d like to fix it in Wisej if possible.

In general, when porting from winforms to wisej, the System.Windows.Forms namespace should be eliminated completely. Our service partner has already developed a tool to seamlessly convert very complex Winforms apps to Web apps with a single click. It has been used already on several projects and not it’s being adapted to Wisej because we were using our framework based on VWG which is now based on Wisej. I can send you a link to a video if you are interested.

Best,

Luca

  • You must to post comments
Showing 3 results