-
Notifications
You must be signed in to change notification settings - Fork 2
/
NotBeginsWith.vb
68 lines (66 loc) · 2.97 KB
/
NotBeginsWith.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Imports DevExpress.Data.Filtering
Namespace DXSample.CustomFunctions
Public Class NotBeginsWithFunction
Implements ICustomFunctionDisplayAttributes
Public Const FunctionName As String = "NotBeginsWith"
Private Shared ReadOnly instance As New NotBeginsWithFunction()
Public Shared Sub Register()
CriteriaOperator.RegisterCustomFunction(instance)
End Sub
Public Shared Function Unregister() As Boolean
Return CriteriaOperator.UnregisterCustomFunction(instance)
End Function
Public ReadOnly Property Category As FunctionCategory Implements ICustomFunctionOperatorBrowsable.Category
Get
Return FunctionCategory.Text
End Get
End Property
Public ReadOnly Property Description As String Implements ICustomFunctionOperatorBrowsable.Description
Get
Return "<description>"
End Get
End Property
Public Function IsValidOperandCount(count As Integer) As Boolean Implements ICustomFunctionOperatorBrowsable.IsValidOperandCount
Return count = 2
End Function
Public Function IsValidOperandType(operandIndex As Integer, operandCount As Integer, type As Type) As Boolean Implements ICustomFunctionOperatorBrowsable.IsValidOperandType
Return type Is GetType(String)
End Function
Public ReadOnly Property MaxOperandCount As Integer Implements ICustomFunctionOperatorBrowsable.MaxOperandCount
Get
Return 2
End Get
End Property
Public ReadOnly Property MinOperandCount As Integer Implements ICustomFunctionOperatorBrowsable.MinOperandCount
Get
Return 2
End Get
End Property
Public Function Evaluate(ParamArray operands() As Object) As Object Implements ICustomFunctionOperator.Evaluate
If operands(0) IsNot Nothing AndAlso operands(1) IsNot Nothing Then
Dim str1 As String = operands(0).ToString()
Dim str2 As String = operands(1).ToString()
Return Not str1.StartsWith(str2, StringComparison.InvariantCultureIgnoreCase)
End If
Return False
End Function
Public ReadOnly Property Name As String Implements ICustomFunctionOperator.Name
Get
Return FunctionName
End Get
End Property
Public ReadOnly Property DisplayName As String Implements ICustomFunctionDisplayAttributes.DisplayName
Get
Return "Not begins with"
End Get
End Property
Public ReadOnly Property Image As Object Implements ICustomFunctionDisplayAttributes.Image
Get
Return "FontSizeDecrease;Office2013"
End Get
End Property
Public Function ResultType(ParamArray operands() As Type) As Type Implements ICustomFunctionOperator.ResultType
Return GetType(Boolean)
End Function
End Class
End Namespace