ApplicationFormBase

Updated: 13 May 2019

The ApplicationFormBase class is the base class for all Tekla Structures dialogs. The class enables the following:

  • Tekla Structures data types and conversions

  • Default storing of values

  • Multiple language support

Tekla Open API applications that want to make full use of ApplicationFormBase should inherit from it. However, this is not needed when only making use of some of its features.

Applications that inherit from ApplicationFormBase must call InitializeForm() method. Call it after the InitializeComponent() method of the Form as follows:

using Tekla.Structures.Dialog; 
 
public class MainForm : ApplicationFormBase 
{     
    MainForm()     
    {  
        InitializeComponent();         
        InitializeForm();     
    }
}

 

The following code example shows one way to initialize an application making use of a local .XML file holding the translated strings.

using Tekla.Structures.Dialog; 
using Tekla.Structures.Datatype; 
 
public class MainForm : ApplicationFormBase 
{     
    MainForm()     
    {         
        InitializeForm();
        if(GetConnectionStatus())         
        {             
            string messageFolder = null; 
            Model.GetAdvancedOption("XS_MESSAGES", ref messageFolder); 
            messageFolder = Path.Combine(messageFolder, @"DotAppsStrings"); 
            Dialogs.SetSettings(string.Empty); 
            Localization.Language = (string) Settings.GetValue("language"); 
            Localization.LoadFile(Path.Combine(messageFolder, Application.ProductName + ".xml")); 
            Localization.Localize(this);         
        }         
        else         
        {             
            MessageBox.Show("Tekla Structures is NOT running...");        
        }     
    } 
}

 

Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.