PowerBuilder to Windows Forms Online Presentation


Demo presentation text:

Hello!

Today Ispirer shows how Ispirer Migration and Modernization Toolkit 2015 (MnMTK 2015) can automatically migrate PowerBuilder application to .NET platform using Windows Forms technology. In this case, we will have standalone application. First of all let’s look at PowerBuilder application. It is an application that is used in order to select data from Microsoft SQL Server database and to represent it in a window. We have some filter that can sort data by unique number.

Let’s look at sources of this application. “Simple_demo” is application source and it is central point of application. Here we can see that connection settings are defined and “simple_demo_main” window is opening when we start our application. On “simple_demo_main” we have several PowerBuilder controls like statictext, singlelineedit, commandbutton and DataWindow to represent the data from database.

Below you can see the definitions of these controls. Also we have menu “simple_menu” here and its definition we will open further. Then there are settings for the specific controls - statictext, singlelineedit, commandbutton. For commandbutton control event clicked is added. When we click button, the data will be filtered by specific criteria defined in singlelineedit and then data will be represented in DataWindow.

In “n_simple_demo_connectservice” there are settings and options for connection and also some methods are written for description of errors if they appear during running of our application.

In menu we can see the definition of menu items – “File” with sub-items “Item1” and “Items2” and “About”with event clicked - when we click “simple_about” window appears.

“Simple_about” is another window with statictext control with definition about this application.

And, finally, let’s look at DataWindow – there are definition of user interface for columns and retrieve with PBSELECT from table “simple_demo” with columns – name and age to show data in data grid.

Let’s run this application and test how it looks.

The names and ages appear in DataWindow. There is menu with menu items on the top. If we click on “About” menu item we can see another window with definition of application.

We can test event for sorting data in DataWindow. For example, we want to see only names with ages that are equal 25. Here you can see that only names with age 25 appear, or for example, for age 40 – we can see that there is only one name.

Let’s look how Ispirer Migration Toolkit 2015 can automatically migrate this application to .NET environment. For this purpose we can use Migration and Modernization Engine. Before running the migration we need to extract all sources to a separate directory – in our case it is SRC and here we can see DataWindow, user object, 2 windows, application source and menu.

We need to specify command options for running Ispirer MnMTK 2015. In Ispirer MnMTK BAT file we have: First - path to Ispirer MnMTK 2015 - it depends on where the tool is installed, Source- in our case its Power Builder scripts, target- C#, option F – the path to the source. And DIR option – it is the folder where conversion results will be placed. And INI option – it is option with the path to our configuration file Ispirer MnMTK ini file and in this script we should specify options that we need for this conversion. Let’s open MnMTK ini file. For this conversion we need to specify only one option UI_TYPE in CS directory and put here WINFORMS.

In this case user interface will be generated in Windows Forms technology.

Finally, we can run the migration by running BAT file.

The migration process starts. Here we can see the number of Ispirer MnMTK build that is used for this migration.

Ispirer Migration Toolkit 2015 can recognize 6 files for migration. Now they are extracted and below there is the conversion of all files with the information about lines of code and how many seconds is necessary to complete the migration of separated PowerBuilder object.

The conversion results appear in “rslt_WinForms” directory. Ispirer MnMTK log file is created with the information about the conversion – what PowerBuilder objects were migrated, how many lines, how many seconds is necessary to complete the migration process. In the end of script there is total information about the migration. Our whole application consists 6 scripts with near ~ 500 lines and we need only half a minute to complete the migration process.

Let’s copy these C# files generated and place them into empty .NET solution. We can run this application and see how it works and how PowerBuilder statements and constructions are migrated to .NET Windows Forms application. Let’s rebuild the solution – and we can see that it is successful and now let’s look through the C# generated files.

Simple_demo.cs is the same with application source in Power Builder. Now we are running “simple_demo_main” window. Let’s go to “simple_demo_main” . Our tool can automatically separate UI logic from source code logic, in designer we can see the definitions of controls. We have simple Menu, Label, Textbox, Button and DataGridView for DataWindow. There are C# events in the source code for LOAD of DataWindow and for CLICK of Button. There is filter like in PB here.

Also we can see the menu. The menu of PB is converted to user control with event click for menu item “About”. Menu goes to MenuStrip in the component designer and it is composed like in PowerBuilder.

Another window “simple_about” contains only one label. And on this label we have text of this demo application.

PowerBuilder User object is converted to the C# class with C# methods for database.

Finally, DataWindow is converted to C# class that has inheritance to ISDataSource – automatically generated class for database access through SqlClient for working with Microsoft SQL Server.

There are several methods here, for example Fill – it is a method to represent data on DataGridView.

On DataWindow we only have Retrieve method with select command – during the migration PBSELECT from PowerBuilder converts to standard SQL syntax. And on main window we only add this data source to DataGridView and then we represent data via Retrieve method.

As a result, we have C# application in .NET environment using Windows Forms technology that can be run and we can test how it works. This application is like Power Builder - it has main window and menu. We can click about menu and see another window with the information about the application. There is DataGrid with 2 columns – name and age. Filter works like in PB and we can test it. For example let’s look at names that have age 19 – there are 2 results. And for age 40 – there is only 1 like in PowerBuilder. You can see that this application is the same like PB and has the same functionality like PowerBuilder.

As you could see, Ispirer Migration & Modernization Toolkit 2015 can automatically run your migration from PowerBuilder to .NET and our tool can minimize your efforts in this type of migration. If you are interested in these services please contact us. You can see our contact information on our web site ispirer.com. Thanks for your attention. Bye.

Do you want to move from PowerBuilder to Windows Forms?

Let's do it together!

Learn more