LogoLogo
WinForms to WebPowerBuilder to .NETPowerBuilder to Java
  • WebMAP Documentation | Mobilize.Net
  • WinForms
    • Introduction
    • Getting Started
    • Conversion Process
    • Post-Conversion
    • Extend or Modify the Converted Application
      • NoWebMap Forms Winforms
        • How to add a new Form
        • Adding the created form to the migrated App
        • Interacting with the application data
        • Call the custom API
        • Interaction between the no webmap added Form and the WebMap components
      • Adding a component
      • Adding a component dynamically
      • Add a new control model
      • Switching CSS theme
      • Adding new window
      • Conversion Configuration
        • WebMAP configuration file
        • Stub Filter
      • Adding Non-WebMap Angular Forms
      • Adding FrontEnd Handler to a ToolStripMenuItem
      • Changing ToolStripButton icons
      • Adding new items to existing toolbar
      • Adding FrontEnd element properties and JS listeners
      • Adding FrontEnd output handlers
      • Access FrontEnd components
      • Create custom components based on existing WebMap Component
      • Override FrontEnd methods
    • Assessment Mode
    • Errors and Troubleshooting
      • How to resolve broken reference problems with VBUC
    • Portability
    • Glossary
    • Release Notes
    • Internal Demos
    • Known Issues
    • WinForms DCP
  • WebForms
    • Introduction
    • Overview
    • Desktop Compatibility Platform (DCP)
      • Pages and Master Pages
      • GridView and DataList data synchronization
      • HTTP objects
    • Post-Conversion
    • Extend or Modify the Converted Application
      • Adding FrontEnd validator
      • Adding Page
      • Adding MasterPage
    • Designer classes on WebForms Conversion Tool
    • Errors and Troubleshooting
      • How fix Solution when have been added website from filesystem without project file
    • Release Notes
  • PowerBuilder to .Net
    • Introduction
    • Getting Started
      • Conversion Tool
    • Desktop Compatibility Platform (DCP)
      • Data Manager
    • Reports
      • Report Rendering in Modernized Code
      • ReportWatcher Service Configuration
      • Data Manager to RDL Conversion
      • Reporting Service Internals
      • Troubleshooting
  • PowerBuilder to Java
    • Introduction
    • Getting started
    • Post-Conversion
      • Setup PBJava Environment
      • Architecture
      • App Start
    • Glossary
    • Errors
    • Glossary
    • FAQ
      • How to create a new Control
      • How to create a new Screen
      • What is the Mobilize.WebMAP.CoreServices.All?
      • What is the DesignerAttribute?
      • What is the InterceptedAttribute?
      • What is the InterceptedAttribute?
      • What is the ObservableAttribute?
      • What is the Mobilize.Weaving.WebMAPExtensions.All?
  • General
    • FrontEnd
      • Documentation
        • Webforms Angular Components
          • Web Components
            • Base Components
              • BaseValidator Component
            • KendoUI Components
              • CompareValidator
              • CustomValidator
              • RegularExpressionValidator
              • RequiredFieldValidator
              • ValidationSummary
          • Directives
          • AJAX Web Components
            • AjaxCalendar
            • AjaxModalPopupExtender
          • Ajax Interaction Services
        • Client Core
          • WebMap's Client Core
        • Angular Client
          • Introduction
          • WebMap Service
          • WebMap Interceptor Service
        • Base Components
          • Introduction
          • Components
            • Container
            • Control
            • ControlContainer
            • FormsContainer
            • Loading
            • Stub
        • Winforms Angular Components
          • Web Components
            • Base Components
              • Control Component
              • Form Container
              • Grid Component
              • Style
            • KendoUI Components
              • AdoDataControl
              • Button
              • C1TrueDBGrid
              • CheckBox
              • CheckedListBox
              • ComboBox
              • ContextMenuStrip
              • DataGridView
              • DataGridViewFlex
              • DateTimePicker
              • FileDialog
              • GroupBox
              • Label
              • ListBox
              • ListView
              • MaskedTextBox
              • MessageBox
              • NumericUpDown
              • Panel
              • PictureBox
              • PrintDialog
              • ProgressBar
              • RadioButton
              • RichTextBox
              • StatusStrip
              • Stup
              • TabControl
              • TabPage
              • TextBox
              • Timer
              • ToolStrip
              • TreeView
              • WebBrowser
              • Window
            • JQuery Web Components
          • WebMap FrontEnd Architecture
          • Migrated Structure
          • Setup
            • Front-End setup and compilation
            • Components Manual
            • Browser Support
            • Unit Test Manual
            • Development Process
            • Setup AOT/JIT Compilation
          • Decorators
            • Server Event
          • Conventions
            • Application Structure and NgModules
            • Coding
            • Components
            • Data Service
            • Directives
            • Lifecycle hooks
            • Names
            • Services
        • PowerBuilder Kendo Components
          • Base Components
            • base-component
            • column-control
            • controlcontainer
          • Data Manager Componets
            • base-data-manager
            • data-manager-control
            • data-manager-control-base
            • dw-checkbox
            • dw-column
            • dw-complexNumericMaskComponent
            • dw-compute
            • dw-date-time-edit-mask
            • dw-dropdowndatawindow
            • dw-edit
            • dw-edit-mask
            • dw-radio-button
            • dw-simple-numeric-edit-mask
            • dw-string-edit-mask
            • dw-time-edit-mask
          • Window Components
            • basemask
            • graphics
            • w-checkbox
            • w-command-button
            • w-complex-numeric-mask
            • w-date-time-edit-mask
            • w-dropdownlistbox
            • w-group-box
            • w-line
            • w-listbox
            • w-maskedtextbox
            • w-mdiclient
            • w-menu
            • w-multiline
            • w-picture
            • w-picture
            • w-radiobutton
            • w-rectangle
            • w-simple-numeric-edit-mask
            • w-single-line-edit
            • w-statictext
            • w-string-edit-mask
            • w-time-edit-mask
            • w-toolbar
            • w-toolbaritem
            • w-user-object
            • w-window
          • Services
            • DmInteractionService
          • DataManagerEvents
          • FocusManager guide
      • Api Documentation
        • WebMap Silverlight
        • WfNetC1Components
        • WebFormsComponents
      • Guides
        • Setup NPM package registry in the workspace
        • How to Setup WebMap Applications To Run Over SubDomains or WebApplications In IIS
        • Deploy several WebMap Apps in the same Server
        • Update to Angular 16
        • Appearance
          • How to change the CSS
          • How to override the style for a component
        • Component maintenance
          • How link WebMap package to the migrated Application
          • How to resolve broken reference problems with VBUC
          • How to test a local WebMap Components package
          • How to add a new component in a migrated application
          • How to update a component
          • Dynamic Control Support
          • How to add new set of component with a different provider
          • How to test your component in the playground
          • Tools
        • WMLogger
          • How to use the WMLogger's instance
          • How to change log's level
          • How to add log tags
        • Integration test
        • Setup WebMap Applications to Run Front-End And Back-End In Separates Sites
          • Setup WebMap Applications To Run Front-End And Back-End In Separates Sites in Production (IIS)
        • Setup Migrated WebMap Applications To Run Front-end & Back-end In Separates Sites (Only development)
        • Initial Set Up
          • Software to Install
          • Necessary Repositories
      • Errors
      • Version Notes
        • Client Core
        • Angular Client
        • Web Base Components
        • Winforms Angular Components
        • PowerBuilder Kendo Components
      • Licenses
        • Client Core
        • Angular Client
        • Base Components
        • PB Kendo Components
        • WFNet Kendo Components
        • WebForms Components
        • WFNet Access Components
        • WFNet Janus Components
        • WFNet C1 Components
        • Silverlight wms-framework
        • Silverlight i-components
    • BackEnd
      • WebMAP From Scratch
      • Setup
      • DCP: Desktop Compatibly Platform
        • Overview
        • Library Bundles
          • Bundle Library
            • Create an Observable Object
          • Bundle DTO
            • DTO: Data Transfer Objects
              • Creating a DTO
            • Mappers
              • Create Mappers
            • Observable Wrappers
              • Create an Observable Wrapper
            • API/Controllers
      • Architecture
      • Weaving on WebMAP
      • Glossary
      • FAQ
        • How to create a new Control
        • How to create a new Screen
        • What is the Mobilize.WebMAP.CoreServices.All?
        • What is the DesignerAttribute?
        • What is the InterceptedAttribute?
        • What is the Mobilize.Extensions.Logging.RollingFile?
        • What is the ObservableAttribute?
        • What is the Mobilize.Weaving.WebMAPExtensions.All?
      • Licenses
        • PBNet DCP
        • WebFormsDCP
        • WFNet DCP
        • CoreServices
        • CoreServicesCommon
    • Request and Response
  • SCALABILITY
    • Introduction
    • Microservices
    • Containerizing a WebMap .Net Application with Docker
    • Vertical scalability
Powered by GitBook
On this page
  • 1. Back-end: Create the screen Form2.cs
  • 2. Front-end: Create the typescript, html, css and export the new screen.
  • 2.1 Add a new folder
  • 2.2 Create Typescript angular component
  • 2.3 Create the html
  • 2.3 Create the css
  • 2.4 Exporting the new created component
  • 3. Compile and run

Was this helpful?

  1. PowerBuilder to Java
  2. FAQ

How to create a new Screen

Suppose you already have a migrated application with the following project structure:

  • Back-end

    • App1

      • Form0.cs

      • Form1.cs

  • Front-end

    • app1-angular

      • app1

        • Form0

          • form0.component.ts

          • form0.component.html

          • form0.component.css

        • Form1

          • form1.component.ts

          • form1.component.html

          • form1.component.css

        • index.ts

      • app1.module.ts

      • component_definitions.ts

And you want to implement the following user story:

As a user, I want to be able to navigate to a new screen, in which I can click on a button and then a label shows the text: "Hello World".

Based on the user story described above, the screen should be like the following image:

And after clicking the button, it should be like this:

In order to implement this user story, you will have to do the following things:

  1. Create the screen Form2.cs in back-end code.

  2. Create the screen in front-end code and export the new screen. The new screen consists on the following components:

    • form2.component.html

    • form2.component.ts

    • form2.component.css

1. Back-end: Create the screen Form2.cs

Please follow the following steps: First, we have to create the class Form2.cs, add the ObservableAttribute to the class in order to keep the class within the WebMAP's life cycle. Then make the class extend from Mobilize.Web.Form in order to inherit all the necessary properties and functionalities that is needed in any new screen.

[Observable]
public class Form2 : Mobilize.Web.Form
{
    public Form2()
    {
    }
}

Once we have the class created, we can start adding the functionality that we want for this screen. For this user story, we'll need to use some predefined controls that Mobilize already provides to us such as:

  • Mobilize.Web.Button

  • Mobilize.Web.Label

  • Mobilize.Web.RadioButton

  • Mobilize.Web.CheckBox

  • Mobilize.Web.TextBox

  • Mobilize.Web.TreeView

  • Mobilize.Web.DataGridView

  • Mobilize.Web.PictureBox

  • Mobilize.Web.Panel

For more details of the list of predefined controls, please refer to the section of API.

So, in this screen, lets use a Mobilize.Web.Button and a Mobilize.Web.Label defining them as properties and instantiate them inside the constructor.

[Observable]
public class Form2 : Mobilize.Web.Form
{
    public Form2()
    {
        this.label1 = new Mobilize.Web.Label();
        this.button1 = new Mobilize.Web.Button();

        this.label1.Name = "label1";
        this.label1.Text = "label1";

        this.button1.Name = "button1";
        this.button1.Text = "button1";
        this.button1.Click += new System.EventHandler(this.button1_Click);

        this.Controls.Add(this.label1);
        this.Controls.Add(this.button1);
        this.Name = "app.Form2";
        this.Text = "Form2";
    }

    private void button1_Click(object sender, System.EventArgs e)
    {
        this.label1.Text = "Hello World";
    }

    [Mobilize.WebMAP.Common.Attributes.Intercepted]
    private Mobilize.Web.Label label1 { get; set; }

    [Mobilize.WebMAP.Common.Attributes.Intercepted]
    private Mobilize.Web.Button button1 { get; set; }
}

Please note the following details:

  1. The properties' accessibility could be private, protected or public based on your needs

  2. The properties must have the InterceptedAttribute if you want the property be kept throughout the requests.

  3. The click event of the button1 is bound to the Click EventHandler, when someone clicks on the button in front-end, it will trigger a request, and it should step into the button1_Click method.

2. Front-end: Create the typescript, html, css and export the new screen.

2.1 Add a new folder

Lets create a new folder for Form2 that will contain the typescript angular component, the html and the css for the form. The folder structure would be as below:

  • Front-end

    • app1-angular

      • Form0

        • ...

      • Form1

        • ...

      • Form2

        • ...

2.2 Create Typescript angular component

Lets create the angular typescript component form2.component.ts :

import { Component, ChangeDetectorRef, ElementRef, Output, Renderer2, ViewEncapsulation } from '@angular/core';
import { EventData, dataTransfer} from '@mobilize/base-components';
import { FormComponent } from '@mobilize/winforms-components';
import { WebMAPService } from '@mobilize/angularclient';

@Component({
  selector: 'app-form2',
  styleUrls: ['./form2.component.css'],
  templateUrl: './form2.component.html',
  encapsulation: ViewEncapsulation.None
})
@dataTransfer(['frmapp.Form2'])
export class Form2Component extends FormComponent {
  protected webServices: WebMAPService;

  constructor( wmservice: WebMAPService, changeDetector: ChangeDetectorRef, render2: Renderer2, elem: ElementRef) {
    super(wmservice, changeDetector, render2, elem);
  }
}

In the code above, we need to import some core components given by angular, and we also need to import FormComponent to inherit the properties and functionalities of any screen. Besides, we need to import WebMAPService for the basic delta synchronization and sending requests to WebMAP Back-end.

Besides, we just need to create a class Form2Component (this name follows the angular naming conventions), and the dataTransfer attribute is a decorator is used to register the types of the controls that are going to be displayed dynamically.

2.3 Create the html

First, we need to create a html file: form2.component.html In order to bind with the back-end Form2 class, lets insert the following standard for creating any new html screens:


  
    
      ...
    
  

The html above is using a wm-window, which is a Mobilize Front-end generic component for supporting the System.Widows.Forms.

Second, we will need to bind with the button1 and label1 that we have previously defined in the back-end code, so lets insert one front-end button html tag and label html tag: wm-button and wm-label.

The wm-button with id button1 has a two-way binding with model.button1 (this property binds automatically with the back-end's button1 property).

The wm-label with id label1 has a two-way binding with model.label1 (this property binds automatically with the back-end's button1 property).

The class attribute we defined like: app_Form2, button1 and label1 will be used in the css to bind with the styles.

NOTE: Please note that you can add any other html tags here for extending other functionalities you want. The most important thing is that you will need to bind it with some angular component.

2.3 Create the css

First, we need to create a html file: form2.component.css Then, we just have to define some styles as below:

.app_Form2 {
    /* you can add any other style here */
    left: -1px;
    top: -1px;
}
.app_Form2 .Form2 {
    /* you can add any other style here */
    width: 800px;
    height: 450px;
    overflow: hidden;
}
.app_Form2 .button1 {
    /* you can add any other style here */
    left: 31px;
    top: 23px;
    position: absolute;
    width: 75px;
    height: 23px;
    padding: 0px 0px 0px 0px;
    display: table-cell;
    vertical-align: middle;
    display: table-cell;
}
.app_Form2 .label1 {
    /* you can add any other style here */
    white-space: nowrap;
    overflow: hidden;
    left: 28px;
    top: 61px;
    position: absolute;
    width: auto;
    height: auto;
}

NOTE: Please note that you can add any style that you want to personalize the look and feel for the new screen.

2.4 Exporting the new created component

To export the new component, we need to add some code in the following files ( please refer to the project structure on the start of this guide)

  1. index.ts

  2. app1.module.ts

  3. component_definitions.ts

index.ts

//...
import { Form2Component } from './form2/form2.component';
//...
export { Form2Component };

app1.module.ts

@NgModule({
imports: [
  //...
],
exports: [
     //...
      app.Form2Component,
],
declarations: [
     //...
      app.Form2Component,
],
entryComponents: [
      //...
      Definitions.app_Form2Component,
],
  //...
})
export class app1Module { }

component_definitions.ts

//...
import { Form2Component as app_Form2Componentfrom './components/app
//...
export { app_Form2Component};

3. Compile and run

When we have both back-end and front-end code created, we just have to compile both back-end and front-end and run it.

PreviousHow to create a new ControlNextWhat is the Mobilize.WebMAP.CoreServices.All?

Was this helpful?