| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- using ivf_tl_Entity.Entity.balance;
- using ivf_tl_Entity.Enums;
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Data;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- namespace ivf_tl_Manage.Converts
- {
- public class DishInfoUserOnlyVipConvert : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- try
- {
- var type = parameter.ToString();
- if (value != null && value.ToString() == "1")
- {
- switch (type)
- {
- case "border":
- return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#804D75AC"));
- case "rectangle1":
- return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#E2EBF9"));
- case "rectangle2":
- return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7092C4"));
- case "editButton":
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EditVipIcon.png", UriKind.Absolute));
- }
- }
- switch (type)
- {
- case "border":
- return new SolidColorBrush(Colors.Transparent);
- case "rectangle1":
- return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#C1C1C1"));
- case "rectangle2":
- return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#CFCFCF"));
- case "editButton":
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EditIcon.png", UriKind.Absolute));
- }
- return null;
- }
- catch (Exception)
- {
- return null;
- }
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- public class DishInfoDataAndVipConvert : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- try
- {
- var type = parameter.ToString();
- if (value is Dish dish && dish.id > 0)
- {
- switch (type)
- {
- case "DishHeadshot":
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishHeadshot.png", UriKind.Absolute));
- case "DishName":
- if (dish.vip == 1) return new SolidColorBrush(Colors.White);
- return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4D4D4D"));
- case "EditButton":
- return Visibility.Visible;
- case "AddButton":
- return Visibility.Hidden;
- case "DishInfo":
- return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4D4D4D"));
- case "StartTime":
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishStartTimeIcon.png", UriKind.Absolute));
- case "FaYuTime":
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishStageIcon.png", UriKind.Absolute));
- }
- }
- switch (type)
- {
- case "DishHeadshot":
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishNoDataHeadshot.png", UriKind.Absolute));
- case "DishName":
- return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ABABAB"));
- case "EditButton":
- return Visibility.Hidden;
- case "AddButton":
- return Visibility.Visible;
- case "DishInfo":
- return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ABABAB"));
- case "StartTime":
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishNoDataStartTimeIcon.png", UriKind.Absolute));
- case "FaYuTime":
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishNoDataStageIcon.png", UriKind.Absolute));
- }
- return null;
- }
- catch (Exception)
- {
- return null;
- }
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- public class DishInfoDataAndVipConvert1 : IMultiValueConverter
- {
- public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
- {
- var type = parameter.ToString();
- var value1 = values[0];
- var value2 = values[1];
- if ((value1 != null && value1 is Dish dish && dish.id > 0) || (value2 != null && value2 is Balance balance && balance.id > 0))
- {
- switch (type)
- {
- case "DishHeadshot":
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishHeadshot.png", UriKind.Absolute));
- case "EditButton":
- return Visibility.Visible;
- case "AddButton":
- return Visibility.Hidden;
- case "DishInfo":
- return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4D4D4D"));
- case "StartTime":
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishStartTimeIcon.png", UriKind.Absolute));
- case "FaYuTime":
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishStageIcon.png", UriKind.Absolute));
- }
- }
- switch (type)
- {
- case "DishHeadshot":
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishNoDataHeadshot.png", UriKind.Absolute));
- case "DishName":
- return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ABABAB"));
- case "EditButton":
- return Visibility.Hidden;
- case "AddButton":
- return Visibility.Visible;
- case "DishInfo":
- return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ABABAB"));
- case "StartTime":
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishNoDataStartTimeIcon.png", UriKind.Absolute));
- case "FaYuTime":
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishNoDataStageIcon.png", UriKind.Absolute));
- }
- return null;
- }
- public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- public class DishInfoOnlyHouseConvert : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- try
- {
- var type = parameter.ToString();
- if (value is House house && house.id > 0 && ((house.embryoRecordVO != null && house.embryoRecordVO.id > 0) || (house.balanceVO != null && house.balanceVO.id > 0)))
- {
- switch (type)
- {
- case "Background":
- if (house.pressureAlarm == 1 || house.temperatureAlarm == 1) return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishInfoYuanAlarmBackgroundIcon.png", UriKind.Absolute));
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishInfoYuanBackgroundIcon.png", UriKind.Absolute));
- case "CanvasBackground":
- if (house.pressureAlarm == 1 || house.temperatureAlarm == 1)
- {
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishInfoAlarmBackgroundIcon.png", UriKind.Absolute));
- }
- else
- {
- if(house.houseState == (int)HouseStateEnum.AirSwapWorking)
- {
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishInfoAirBackgroundIcon.png", UriKind.Absolute));
- }
- else
- {
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishInfoBackgroundIcon.png", UriKind.Absolute));
- }
- }
- case "HouseForeground":
- if (house.pressureAlarm == 1 || house.temperatureAlarm == 1) return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#C85553"));
- return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4D75AC"));
- }
- }
- switch (type)
- {
- case "Background":
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishInfoYuanNoDataBackgroundIcon.png", UriKind.Absolute));
- case "CanvasBackground":
- return new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DishInfoBackgroundIcon.png", UriKind.Absolute));
- case "HouseForeground":
- return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#9B9B9B"));
- }
- return null;
- }
- catch (Exception)
- {
- return null;
- }
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|