本文整理汇总了VB.NET中System.Workflow.ComponentModel.Compiler.ActivityValidator类的典型用法代码示例。如果您正苦于以下问题:VB.NET ActivityValidator类的具体用法?VB.NET ActivityValidator怎么用?VB.NET ActivityValidator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ActivityValidator类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: ConsoleWriteLineActivityValidator
Class ConsoleWriteLineActivityValidator
Inherits ActivityValidator
Public Overrides Function Validate( _
ByVal manager As System.Workflow.ComponentModel.Compiler.ValidationManager, _
ByVal obj As Object) As System.Workflow.ComponentModel.Compiler.ValidationErrorCollection
'Invoke the base class method implementation to
'perform default validation.
Dim errors As ValidationErrorCollection = MyBase.Validate(manager, obj)
'Make sure there is an activity instance.
Dim crw As ConsoleWriteLineActivity = CType(obj, ConsoleWriteLineActivity)
If crw Is Nothing Then
Throw New InvalidOperationException()
End If
'If the activity has no parent then this validation
'is occurring during the compilation of the activity
'and not during the hosting or creation of an
'activity instance.
If crw.Parent Is Nothing Then
'Can skip the rest of the validation because
'it deals with the hosting and the creation
'of the activity.
Return errors
End If
'Msg is required. Add a validation error if there is no
'Msg specified or Msg is not bound to another property.
If String.IsNullOrEmpty(crw.Msg) And _
crw.GetBinding(ConsoleWriteLineActivity.MsgProperty) Is Nothing Then
errors.Add(New ValidationError("Msg is required", 100, False, "Msg"))
End If
Return errors
End Function
End Class