1 Public Class SpecialFeaturesConverter
2 Implements IMultiValueConverter
4 Public Overridable
Function Convert(ByVal values
As Object(), ByVal targetType
As Type, ByVal parameter
As Object, ByVal culture
As System
.Globalization
.CultureInfo
) As Object Implements IMultiValueConverter
.Convert
5 If values Is
Nothing Or values
.Length
< 2 Then
8 If values(0) = System
.Windows
.DependencyProperty
.UnsetValue
Then
11 If values(1) = System
.Windows
.DependencyProperty
.UnsetValue
Then
14 Dim rating
As Integer = CType(values(0), Integer)
15 Dim theDate
As DateTime
= CType(values(1), DateTime
)
17 ' if the user has a good rating (10+) and has been a member for more than a year, special features are available
18 If (rating
>= 10) And (theDate
.Date < (DateTime
.Now
.Date - New TimeSpan(365, 0, 0, 0))) Then
25 Public Overridable
Function ConvertBack(ByVal value
As Object, ByVal targetTypes
As Type(), ByVal parameter
As Object, ByVal culture
As System
.Globalization
.CultureInfo
) As Object() Implements IMultiValueConverter
.ConvertBack
26 Return New Object(1) {Binding
.DoNothing
, Binding
.DoNothing
}