|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- 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 BPASmartClient.CustomResource.Converters
- {
- public class StatusConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- SolidColorBrush returnValue = Brushes.SandyBrown;
- if (value != null && value is ushort statusValue)
- {
- switch (statusValue)
- {
- case 0:
- returnValue = Brushes.SandyBrown;
- break;
- case 1:
- returnValue = Brushes.Green;
- break;
- case 2:
- returnValue = Brushes.Yellow;
- break;
- case 3:
- returnValue = Brushes.Aqua;
- break;
- case 4:
- returnValue = Brushes.Red;
- break;
- default:
- break;
- }
- }
- return returnValue;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|