终端一体化运控平台
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

70 行
1.8 KiB

  1. using System;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. namespace BPASmartClient.MilkWithTea.Data;
  5. /// <summary>
  6. /// 装箱后的值类型(用于提高效率)
  7. /// </summary>
  8. internal static class ValueBoxes
  9. {
  10. internal static object TrueBox = true;
  11. internal static object FalseBox = false;
  12. internal static object VerticalBox = Orientation.Vertical;
  13. internal static object HorizontalBox = Orientation.Horizontal;
  14. internal static object VisibleBox = Visibility.Visible;
  15. internal static object CollapsedBox = Visibility.Collapsed;
  16. internal static object HiddenBox = Visibility.Hidden;
  17. internal static object Double01Box = .1;
  18. internal static object Double0Box = .0;
  19. internal static object Double1Box = 1.0;
  20. internal static object Double10Box = 10.0;
  21. internal static object Double20Box = 20.0;
  22. internal static object Double100Box = 100.0;
  23. internal static object Double200Box = 200.0;
  24. internal static object Double300Box = 300.0;
  25. internal static object DoubleNeg1Box = -1.0;
  26. internal static object Int0Box = 0;
  27. internal static object Int1Box = 1;
  28. internal static object Int2Box = 2;
  29. internal static object Int5Box = 5;
  30. internal static object Int99Box = 99;
  31. internal static object BooleanBox(bool value) => value ? TrueBox : FalseBox;
  32. internal static object OrientationBox(Orientation value) =>
  33. value == Orientation.Horizontal ? HorizontalBox : VerticalBox;
  34. internal static object VisibilityBox(Visibility value)
  35. {
  36. return value switch
  37. {
  38. Visibility.Visible => VisibleBox,
  39. Visibility.Hidden => HiddenBox,
  40. Visibility.Collapsed => CollapsedBox,
  41. _ => throw new ArgumentOutOfRangeException(nameof(value), value, null)
  42. };
  43. }
  44. }