终端一体化运控平台
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.
 
 
 

70 rivejä
2.2 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. namespace BPASmartClient.CustomResource.UserControls
  16. {
  17. /// <summary>
  18. /// MotorBottle.xaml 的交互逻辑
  19. /// </summary>
  20. public partial class MotorBottle : UserControl
  21. {
  22. public MotorBottle()
  23. {
  24. InitializeComponent();
  25. }
  26. private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
  27. {
  28. (d as MotorBottle)?.Refresh();
  29. }
  30. private void Refresh()
  31. {
  32. bottle.CurrentValue = this.CurrentValue;
  33. VisualStateManager.GoToState(this, IsRun ? "Start" : "Stop", false);
  34. }
  35. public bool IsRun
  36. {
  37. get { return (bool)GetValue(IsRunProperty); }
  38. set { SetValue(IsRunProperty, value); }
  39. }
  40. public static readonly DependencyProperty IsRunProperty =
  41. DependencyProperty.Register("IsRun", typeof(bool), typeof(MotorBottle),
  42. new PropertyMetadata(false, new PropertyChangedCallback(OnPropertyChanged)));
  43. //public bool IsRun
  44. //{
  45. // get { return (bool)GetValue(IsRunProperty); }
  46. // set { SetValue(IsRunProperty, value); }
  47. //}
  48. //public static readonly DependencyProperty IsRunProperty =
  49. // DependencyProperty.Register("IsRun", typeof(bool), typeof(MotorBottle),
  50. // new PropertyMetadata(0, new PropertyChangedCallback(OnPropertyChanged)));
  51. public double CurrentValue
  52. {
  53. get { return (double)GetValue(CurrentValueProperty); }
  54. set { SetValue(CurrentValueProperty, value); }
  55. }
  56. public static readonly DependencyProperty CurrentValueProperty =
  57. DependencyProperty.Register("CurrentValue", typeof(double), typeof(MotorBottle),
  58. new PropertyMetadata(0.0, new PropertyChangedCallback(OnPropertyChanged)));
  59. }
  60. }