added SSCLI 1.0
[windows-sources.git] / sdk / samples / WPFSamples / DataBindingLab / visualbasic / specialfeaturesconverter.vb
blob7b0c2be513008008922235532f86277480b41451
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
6 Return False
7 End If
8 If values(0) = System.Windows.DependencyProperty.UnsetValue Then
9 Return False
10 End If
11 If values(1) = System.Windows.DependencyProperty.UnsetValue Then
12 Return False
13 End If
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
19 Return True
20 End If
21 Return False
22 End Function
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}
27 End Function
29 End Class