Creating A User Interface In Omicron Test Universe Import Filter

Welcome to my page. This is the third part of the Omicron Import Filter tutorial series. In this tutorial, I will show you how to create a User Interface (UI) inside the Import Filter. UI will be helpful to see the activities during import like in the image below. Unlike the traditional way, it just open the setting file then wait until the setting files populated in the test object and wait until the confirmation of completion.


Now open the MyImportFilter project in Visual Studio that we've created in the previous tutorial which can be found here (Omicron Import Filter - Create New Filter and Omicron Import Filter - Install And Use Newly Created Import Filter). Check those tutorials if you haven't done creation of the project.


Now add new form by clicking Add Form (Windows Forms) in the Project menu or right clicking in the MyImportFilter project at the solution explorer then selecting Add > Form (Windows Forms). Set the name to FormSample.vb then click Add button.

Once the new form added, set the following properties below
  • Text - My Import Filter Dialog
  • StartPosition - CenterScreen
  • MinimizeBox - False
  • MaximizeBox - False
  • FormBorderStyle - FixedDialog

Add the following controls and arrange them like in the image below
  • Textbox - 1
  • Label - 1
  • Pushbutton - 3
  • DataGridView - 1

Set the the following controls' properties
  • Textbox1, set the Name to TextboxFilename and ReadOnly to True
  • Button1, set the Name to ButtonBrowseFile and Text to &Browse
  • DataGridView1, set the Name to DataGridViewParameters
  • Label1, set the Name to LabelStatusMessage and clear the text content
  • Button2, set the Name to ButtonCancel and Text to &Cancel
  • Button3, set the Name to ButtonOK and Text to &OK
  • FormSample, set the AcceptButton to ButtonOK and CancelButton to ButtonCancel

Open the FormSample code window and copy the codes below and paste it to inside the FormSample class.

Private Document As OMXRioData.IAutoXRioDocument

Public Sub DisplayForm(ByVal pDocument As OMXRioData.IAutoXRioDocument)
    Document = pDocument
    ShowDialog()
End Sub

Private Sub ButtonOK_Click(sender As Object, e As EventArgs) Handles ButtonOK.Click
    DialogResult = Windows.Forms.DialogResult.OK
End Sub

Private Sub ButtonCancel_Click(sender As Object, e As EventArgs) Handles ButtonCancel.Click
    DialogResult = Windows.Forms.DialogResult.Cancel
End Sub

Open the SampleFilter class and copy the codes below then replace the ShowParameterDialog procedure.

Public Overrides Function ShowParameterDialog(isImport As Boolean) As Boolean
    Dim Result As Boolean = False
    Using dlg As New FormSample
        With dlg
            dlg.DisplayForm(Document)
            If .DialogResult = Windows.Forms.DialogResult.OK Then
                MsgBox("The import filter was successfully executed.", MsgBoxStyle.OkOnly, "Import Filter")
                Result = True
            End If
        End With
    End Using
    Return Result
End Function

Now, compile or build the project and install the output class to the XRIO directory. To see how to install and execute the new Import Filter check this link (Omicron Import Filter - Install And Use Newly Created Import Filter) .


We have successfully executed the newly modified Import Filter. In the next tutorial, I will show you how to open, read and parse relay setting file particularly in MiCOM P12x relay. I will show you how to manipulate the relay setting file to import the parameters easily. See you next time.


Comments