using Panuon.UI.Silver; using System; using System.Windows; using System.Windows.Controls; using System.Windows.Data; namespace SHJX.Service.Librarys.manual { /// /// LiquidOperate.xaml 的交互逻辑 /// public partial class LiquidOperate : UserControl { public string OpName { set => head.Header = value; } public Visibility PumpInVisibility { set => PumpIn.Visibility = value; } public Visibility PumpOutVisibility { set => PumpOut.Visibility = value; } public bool OutLiquidWaiting { get => (bool)GetValue(OutLiquidWaitingProperty); set => SetValue(OutLiquidWaitingProperty, value); } public static readonly DependencyProperty OutLiquidWaitingProperty = DependencyProperty.Register( nameof(OutLiquidWaiting), typeof(bool), typeof(LiquidOperate), new UIPropertyMetadata(false, OutLiquidWaitingChangedCallback)); private static void OutLiquidWaitingChangedCallback(DependencyObject obj, DependencyPropertyChangedEventArgs args) { var control = obj as LiquidOperate; var path = control?.PumpOut; Binding binding = new Binding { Source = Convert.ToBoolean(args.NewValue) }; BindingOperations.SetBinding(path, ButtonHelper.IsWaitingProperty, binding); } public bool InLiquidWaiting { get => (bool)GetValue(InLiquidWaitingProperty); set => SetValue(InLiquidWaitingProperty, value); } public static readonly DependencyProperty InLiquidWaitingProperty = DependencyProperty.Register( nameof(InLiquidWaiting), typeof(bool), typeof(LiquidOperate), new UIPropertyMetadata(false, InLiquidWaitingChangedCallback)); private static void InLiquidWaitingChangedCallback(DependencyObject obj, DependencyPropertyChangedEventArgs args) { var control = obj as LiquidOperate; var path = control?.PumpIn; Binding binding = new() { Source = Convert.ToBoolean(args.NewValue) }; BindingOperations.SetBinding(path, ButtonHelper.IsWaitingProperty, binding); } public LiquidOperate() { InitializeComponent(); } } }