123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using LampInspectionMachine.Cameralibs;
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Data;
- using System.Windows.Media;
- namespace LampInspectionMachine.ValueConverters
- {
- public class EnumToBoolConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if ( value == null ) return false;
- if ( (bool)value== true&& parameter ?.ToString()=="软触发" )
- {
- return false;
- }
- if ( ( bool ) value == false && parameter?.ToString() == "硬触发" )
- {
- return false;
- }
- return true;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if ( value == null ) return false;
- if ( ( bool ) value == true && parameter?.ToString() == "软触发" )
- {
- return false;
- }
- if ( ( bool ) value == false && parameter?.ToString() == "硬触发" )
- {
- return false;
- }
- return true;
- }
- }
- }
|