If you model and simulate behaviors using Enterprise Architect and AMUSE some Mock UIs based on Windows Forms can improve your model significantly.
AMUSE WindowsForm_without_VS

How you can do that in a simple way? In that case you typically need to:

1. setup an Visual Studio Project and take care of some settings (e.g. usage of 3.5 NET); 2. develop a form; 3. compile the VS project into assembly; 4. import the form into your EA model, AMUSE reverse engineers it from the assembly and create a form class; 5. create an attribute in the class, that contains the state machine of type of reverse engineered form class; 6. connect form events with the state machine triggers; 7. initialize your form at state machine initializing phase
We recommend not import the form class directly but rather to create a wrapper class that contains only the events and methods you really need for modeling, otherwise the reverse engineered form class contains too much stuff inherited from the Form basis class. That means you have basically one more step to do.

The described procedure is not really complex and after performing it once you have a reusable template. In addition you develop and test the UI in very comfortable VS development environment.

But what if the usage of VS is not an option or you just want to perform the whole modeling using EA environment only?
– Not a problem at all Winking smile. Following XMI contains a simple model including an integrated Windows Form: simple model including an integrated Windows Form
Please find below the corresponding video:

Login Windows Form integrated in a EA UML model

The idea is as simple as the implementation itself. First of all we have to know which .NET assemblies are referenced by AMUSE and therefore are available for behavior programming: System; System.Core; System.Data; System.XML; WindowsBase and most important for us System.Windows.Forms
Following steps are to do:

1. create an attribute e.g. testDialog of type System.Windows.Forms.Form with following initial value: new System.Windows.Forms.Form()
2. create a method e.g. ShaowDialog() responsible for the form initialization. Please find the example initial code below:

//the layout panel is required for positioning of controls we create below
System.Windows.Forms.FlowLayoutPanel MyFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();

//ensure that we create controls and add them to the form only once
//later on if the form is closed or hidden just show it again
if(testDialog.Controls.Count < 1)
    testDialog.Text = "Loginform";

    System.Windows.Forms.Label NameLabel = new System.Windows.Forms.Label(); 
    NameLabel.Text = "UserName";

    System.Windows.Forms.TextBox NameBox = new System.Windows.Forms.TextBox();
    NameBox.Name = "NameBox";

    System.Windows.Forms.Label PasswordLabel = new System.Windows.Forms.Label();
    PasswordLabel.Text = "Pasword";

    System.Windows.Forms.TextBox PasswordBox = new System.Windows.Forms.TextBox();
    PasswordBox.Name = "PasswordBox";
    PasswordBox.PasswordChar = '*';

    System.Windows.Forms.Button CloseButton = new System.Windows.Forms.Button();
    CloseButton.Text = "Submit";


    //prevent hiding the dialog
    testDialog.TopMost = true;
    //connect button click event to the class operation OnSubmit
    CloseButton.Click += new System.EventHandler(this.OnSubmit);

3. Create form event handler class operation e.g. OnSubmit(). Please find the example initial code below:

//TODO:: error handling

//get the form from event args
System.Windows.Forms.Form myForm = ((System.Windows.Forms.Control)sender).FindForm();

//assign the strings from the name and password boxes to corresponding class attributes
this.Username = ((System.Windows.Forms.Control)myForm.Controls.Find("NameBox", true)[0]).Text;
this.Password = ((System.Windows.Forms.Control)myForm.Controls.Find("PasswordBox", true)[0]).Text;


//fire trigger by calling identically named TriggerEvent method

4. Finally dispose dialog at state machine finalization e.g. implemented in a separate class operation DisposeDialog(). Please find the example initial code below:


That’s it.