LiquidOperate.xaml.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using Panuon.UI.Silver;
  2. using System;
  3. using System.Windows;
  4. using System.Windows.Controls;
  5. using System.Windows.Data;
  6. namespace SHJX.Service.Librarys.manual
  7. {
  8. /// <summary>
  9. /// LiquidOperate.xaml 的交互逻辑
  10. /// </summary>
  11. public partial class LiquidOperate : UserControl
  12. {
  13. public string OpName
  14. {
  15. set => head.Header = value;
  16. }
  17. public Visibility PumpInVisibility
  18. {
  19. set => PumpIn.Visibility = value;
  20. }
  21. public Visibility PumpOutVisibility
  22. {
  23. set => PumpOut.Visibility = value;
  24. }
  25. public bool OutLiquidWaiting
  26. {
  27. get => (bool)GetValue(OutLiquidWaitingProperty);
  28. set => SetValue(OutLiquidWaitingProperty, value);
  29. }
  30. public static readonly DependencyProperty OutLiquidWaitingProperty =
  31. DependencyProperty.Register(
  32. nameof(OutLiquidWaiting), typeof(bool),
  33. typeof(LiquidOperate), new UIPropertyMetadata(false, OutLiquidWaitingChangedCallback));
  34. private static void OutLiquidWaitingChangedCallback(DependencyObject obj, DependencyPropertyChangedEventArgs args)
  35. {
  36. var control = obj as LiquidOperate;
  37. var path = control?.PumpOut;
  38. Binding binding = new Binding
  39. {
  40. Source = Convert.ToBoolean(args.NewValue)
  41. };
  42. BindingOperations.SetBinding(path, ButtonHelper.IsWaitingProperty, binding);
  43. }
  44. public bool InLiquidWaiting
  45. {
  46. get => (bool)GetValue(InLiquidWaitingProperty);
  47. set => SetValue(InLiquidWaitingProperty, value);
  48. }
  49. public static readonly DependencyProperty InLiquidWaitingProperty =
  50. DependencyProperty.Register(
  51. nameof(InLiquidWaiting), typeof(bool),
  52. typeof(LiquidOperate), new UIPropertyMetadata(false, InLiquidWaitingChangedCallback));
  53. private static void InLiquidWaitingChangedCallback(DependencyObject obj, DependencyPropertyChangedEventArgs args)
  54. {
  55. var control = obj as LiquidOperate;
  56. var path = control?.PumpIn;
  57. Binding binding = new()
  58. {
  59. Source = Convert.ToBoolean(args.NewValue)
  60. };
  61. BindingOperations.SetBinding(path, ButtonHelper.IsWaitingProperty, binding);
  62. }
  63. public LiquidOperate()
  64. {
  65. InitializeComponent();
  66. }
  67. }
  68. }