终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

53 lines
1.5 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Globalization;
  5. using System.Linq;
  6. using System.Windows.Data;
  7. using System.Windows.Media;
  8. namespace BPASmartClient.DosingSystem.Converter
  9. {
  10. public class DataTableRedundantConverter : IValueConverter
  11. {
  12. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  13. {
  14. if (value != null && value is bool bit)
  15. {
  16. if (bit)
  17. return new SolidColorBrush(Color.FromArgb(255, 245, 63, 98));
  18. else
  19. return new SolidColorBrush(Color.FromArgb(255, 42, 178, 231));
  20. }
  21. return default;
  22. }
  23. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  24. {
  25. throw new NotImplementedException();
  26. }
  27. }
  28. public static class ObserDo
  29. {
  30. /// <summary>
  31. /// 倒叙插入
  32. /// </summary>
  33. /// <typeparam name="T"></typeparam>
  34. /// <param name="collection"></param>
  35. /// <param name="items"></param>
  36. public static void AddRange<T>(this ObservableCollection<T> collection, IEnumerable<T> items)
  37. {
  38. if (items!=null&&items.Count<T>()!=0)
  39. {
  40. for (int i = items.Count<T>()-1; i >=0; i--)
  41. {
  42. collection.Insert(0,items.ElementAt(i));
  43. }
  44. }
  45. }
  46. }
  47. }