| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- using ivf_tl_Entity.GlobalEntitys;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Data;
- using System.Windows.Media;
- namespace ivf_tl_Operate.Converts
- {
- public class HouseDoorStateConvert : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value == null) return Visibility.Hidden;
- if (parameter == null) return Visibility.Hidden;
- if (!int.TryParse(parameter.ToString(), out int type))
- {
- return Visibility.Hidden;
- }
- if (int.TryParse(value.ToString(), out int result))
- {
- if(type == 1)
- {
- if(result == 1)
- {
- return Visibility.Visible;
- }
- else
- {
- return Visibility.Hidden;
- }
- }
- else
- {
- if (result == 1)
- {
- return Visibility.Hidden;
- }
- else
- {
- return Visibility.Visible;
- }
- }
- }
- else
- {
- return Visibility.Hidden;
- }
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- public class HouseInfoBackgroundConvert : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if(value == null)
- {
- return "Transparent";
- }
- if(value is ExDish exDish)
- {
- if(exDish.vip == 1)
- {
- return "#fcf1f2";
- }
- else
- {
- return "Transparent";
- }
- }
- else
- {
- return "Transparent";
- }
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- public class HouseInfoBackgroundConvert1 : IMultiValueConverter
- {
- public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
- {
- try
- {
- int alarm = 0;
- SolidColorBrush rs = new SolidColorBrush((Colors.Transparent));
- if (values[0] != null && values[0] is ExDish dish)
- {
- if (dish.vip == 1)
- {
- rs = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#804D75AC"));
- }
- }
- if (values[1] != null && int.TryParse(values[1].ToString(), out alarm))
- {
- if (alarm == 1)
- {
- rs = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#e99c9c"));
- }
- }
- if (values[2] != null && int.TryParse(values[2].ToString(), out alarm))
- {
- if (alarm == 1)
- {
- rs = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#e99c9c"));
- }
- }
- return rs;
- }
- catch (Exception ex)
- {
- return new SolidColorBrush((Colors.Transparent));
- }
- }
- public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|