Show/Hide Toolbars

XSharp

Our 3rd migration example is the Pizza Example. You can find this in the Samples\Controls\Buttons folder in your VO Installation.
I have selected the same output folder (C:\XporterOutput\Examples\) and the XPorter will create a Pizza subfolder with the contents of the AEF and a Pizza solution in the Examples folder.

There is no real need to list the files again. You get the idea.

After opening Pizza.sln inside visual Studio and compiling you will find the following problems:

pizza

The problem is:

The original VO program had an output name 'PIZZA.EXE'.

The X# compiler uses the same logic as the Vulcan compiler and creates a static class called Pizza.Exe.Functions that will hold the functions in the application, the globals and (new for X#) the defines.

The application also has an image called 'PIZZA'.

When we compile this app there is now a conflict between the class named PIZZA and the namespace Pizza (from the class Pizza.Exe.Functions).

This is something that is not recommended by the DotNet standard. Vulcan ignores this and allows both a class Pizza and a namespace Pizza. X# follows the .Net guidelines more closely.

There are 2 solutions to this problem:

oRename the image class Pizza (inside Images.prg)

oRename the output filename. To rename the output filename open the Project Settings (from the Project menu) and set the Assembly Name on the "General" page. You could rename the assembly to PizzaApp and it will solve the problem

In this case I choose to rename the PIZZA image. So open Images.PRG and rename

  CLASS PIZZA INHERIT Bitmap

to

  CLASS ImgPIZZA INHERIT Bitmap

Then recompile again. Now one problem is left:

C:\XporterOutput\Examples\Pizza\Order Dialog.prg(165,25): error XS0246: The type or namespace name 'PIZZA' could not be found (are you missing a using directive or an assembly reference?)

 

This is the place where the Pizza image is used in the example app. To change this, open the Order Dialog window (Order Dialog.ORDERDIALOG.xsfrm). Select the button on the bottom left and change the "Image" text in the property window from Pizza to ImgPizza. Save the form. The code will be regenerated as well.

If you look at the order dialog rc file after the changes you will see that the file has been marked with a header that this code was generated. Also #defines have been added for all windows styles used in the form. The resource is "self contained" so there is no dependency on any external file in the resource file.

Recompile and the program compiles.

When we run the program we see that it works as expected:

Pizza1

 

You will find the "code before" and "code after" in the XSharp Examples folder