Welcome back to Micom SE Studio1 Import Filter tutorial series. In the previous tutorial, I've shown you how to create class module that responsible for setting file processing. Click this link Micom SE Studio1 Import Filter - Creating Class Module For Setting File Process
In this series, I will show you how to use the SEStudio1Import.vb class module that I created in the previous tutorial.
Now open the SEStudio1FilterBase.bv class, copy the codes below and replace the content of this class module.
Imports OMXRioData Public Class SEStudio1FilterBase Inherits OMXRioFilter.FilterBase Private RELAY_PARAMETERS_BLOCK As String = "CUSTOM.RELAY_PARAMETERS" Private AUTHOR_PARAMETER As String = "CUSTOM.AUTHOR.IMPORT_FILTER_AUTHOR" Public Overrides Sub SetParameter(isImport As Boolean, paramName As String, paramValue As String) 'Do nothing End Sub Public Overrides Function ExecuteExport() As Boolean Return False End Function Public Overrides Function ExecuteImport() As Boolean Return True End Function Public Overrides Function GetParameter(isImport As Boolean, paramName As String) As String Return String.Empty End Function Public Overrides Function IsExportSupported() As Boolean Return False End Function Public Overrides Function ShowParameterDialog(isImport As Boolean) As Boolean Dim Result As Boolean = False If isImport Then If IsDocumentValid() Then Dim _UpdateForm As New SEStudio1UIForm With _UpdateForm .DisplayForm(Document) End With _UpdateForm = Nothing Result = True Else MsgBox("The current test plan/routine is not compatible for this import filter. Some validation parameters are missing.", MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "Incompatible Test Plan/Routine") End If End If Return Result End Function Private Function IsDocumentValid() As Boolean Dim Result As Boolean = False Dim Block As IAutoXRioBlock = Document.GetBlockFromIDs(RELAY_PARAMETERS_BLOCK) Dim AuthorParam As IAutoXRioParameter = Document.GetParamFromIDs(AUTHOR_PARAMETER) If Block IsNot Nothing And AuthorParam IsNot Nothing Then If Not String.IsNullOrEmpty(AuthorParam.DisplayString) And AuthorParam.DisplayString = "Author Name" Then Result = True End If End If Block = Nothing AuthorParam = Nothing Return Result End Function End Class
Now, create new class module under the SEStudio1 folder and name it SEStudio1RelayInfo.vb. Then, copy and paste the codes below to SEStudio1RelayInfo.vb class module.
Private _FileType As String Private _FormatVersion As String Private _RelayType As String Private _ModelNumber As String Private _SerialNumber As String Public Sub New() End Sub Public Sub New(ByVal FileType As String, ByVal FormatVersion As String, ByVal RelayType As String, ByVal ModelNumber As String, ByVal SerialNumber As String) _FileType = FileType _FormatVersion = FormatVersion _RelayType = RelayType _ModelNumber = ModelNumber _SerialNumber = SerialNumber End Sub Public Property FileType As String Get Return _FileType End Get Set(value As String) _FileType = value End Set End Property Public Property FormatVersion As String Get Return _FormatVersion End Get Set(value As String) _FormatVersion = value End Set End Property Public Property RelayType As String Get Return _RelayType End Get Set(value As String) _RelayType = value End Set End Property Public Property ModelNumber As String Get Return _ModelNumber End Get Set(value As String) _ModelNumber = value End Set End Property Public Property SerialNumber As String Get Return _SerialNumber End Get Set(value As String) _SerialNumber = value End Set End Property
In the next tutorial, I will show you how to create a dialog box for confirming or showing that the setting file has been open successfully and the setting is ready for upload.
See you nextime.
Comments
Post a Comment