AVEVA OMI Software Developer Kit
Build the App UI

Structure the UI for your app as needed for the framework elements you will use and the business logic you will create. For your UI, you will probably want to specify foreground and background colors, the structure type (for example, Grid or StackPanel), dimensions, static text, etc. Modify the xaml file as needed for your UI.

You can use WPF (Windows Presentation Framework) or WinForms as the front end framework of your application. However, if you use WinForms controls, they must still be hosted in WPF in order for them to be usable in an AVEVA OMI app.

Since foreground color, background color, and text size are UserControl FrameWork element properties, there is no reason to define these. Whenever possible, leverage the properties that already exist in the FrameWork and the AVEVA OMI assemblies with which you are working. In the example code, since StackPanel is a child element of UserControl, we can use binding to set foreground/background colors and text size.

As the example code shows, the default Grid element has been changed to a StackPanel element, and a textbox has been added to displays static text. The UserControl has been renamed as a child element of "MyOMIApp." A pointer has been added within the UserControl definition (x:Name="MyUserControl"), and binding to this pointer is used to set the background color for the StackPanel. Similarly, binding is used to set the foreground color, background color, and font size for the TextBox in the StackPanel. You can then set the properties of these design elements in the cs file, along with the business logic.

To filter which controls are visible to the user, you can add an AppManifest.xml file to filter what users will see when they configure your app in the IDE.

UserControl1.xaml
Copy Code
<UserControl x:Class="MyOMIApp.UserControl1"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     mc:Ignorable="d"
     d:DesignHeight="300" d:DesignWidth="300" x:Name="MyUserControl">
   <StackPanel Background="{Binding Background, ElementName=MyUserControl}">
      <TextBox Text="Welcome to My OMI Navigation Display App"
       Foreground="{Binding Foreground, ElementName=MyUserControl}"
       FontSize="{Binding Fontsize, ElementName=MyUserControl}"></TextBox>
   </StackPanel>
</UserControl>     

The design view of the control shows the static text in a textbox enclosed within the StackPanel.