blob: cd4f60d4c59deefb1daaaf75687a23f699819f6d (
plain)
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
|
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using Tango.MachineStudio.Logging.ViewModels;
namespace Tango.MachineStudio.Logging.Converters
{
public class DateIsInListToBooleanConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length < 2 || !(values[0] is DateTime) || !(values[1] is IEnumerable<DateTime>))
return false;
var date = (DateTime)values[0];
var dateList = (IEnumerable<DateTime>)values[1];
return dateList.ToList().Exists(x => x.ToLocalTime().ToShortDateString() == date.ToLocalTime().ToShortDateString());
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
|