Vce.xaml.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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.Animation;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. namespace Venus_Themes.UserControls
  17. {
  18. /// <summary>
  19. /// Vce.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class Vce : UserControl
  22. {
  23. public Vce()
  24. {
  25. InitializeComponent();
  26. }
  27. public static readonly DependencyProperty VCEOutDoorIsOpenProperty = DependencyProperty.Register(
  28. "VCEOutDoorIsOpen", typeof(bool), typeof(Vce));
  29. public bool VCEOutDoorIsOpen
  30. {
  31. get => (bool)GetValue(VCEOutDoorIsOpenProperty);
  32. set => SetValue(VCEOutDoorIsOpenProperty, value);
  33. }
  34. public static readonly DependencyProperty IsVentingProperty = DependencyProperty.Register(
  35. "IsVenting", typeof(bool), typeof(Vce));
  36. public bool IsVenting
  37. {
  38. get => (bool)GetValue(IsVentingProperty);
  39. set => SetValue(IsVentingProperty, value);
  40. }
  41. public static readonly DependencyProperty VCENameProperty = DependencyProperty.Register("VCEName", typeof(string), typeof(Vce));
  42. public string VCEName
  43. {
  44. get => (string)GetValue(VCENameProperty);
  45. set => SetValue(VCENameProperty, value);
  46. }
  47. public static readonly DependencyProperty PressureValueProperty = DependencyProperty.Register(
  48. "PressureValue", typeof(double), typeof(Vce));
  49. public double PressureValue
  50. {
  51. get { return (double)this.GetValue(PressureValueProperty); }
  52. set { this.SetValue(PressureValueProperty, value); }
  53. }
  54. public static readonly DependencyProperty PercentValueProperty = DependencyProperty.Register(
  55. "PercentValue", typeof(double), typeof(Vce), new PropertyMetadata(0.0, OnDataChanged));
  56. private static void OnDataChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
  57. {
  58. if (d is Vce chamber)
  59. {
  60. DoubleAnimation doubleAnimation = new DoubleAnimation((double)e.OldValue, (double)e.NewValue, new Duration(TimeSpan.FromSeconds(1)));
  61. chamber.rec_Water.BeginAnimation(HeightProperty, doubleAnimation);
  62. }
  63. }
  64. public double PercentValue
  65. {
  66. get { return (double)GetValue(PercentValueProperty); }
  67. set
  68. {
  69. SetValue(PercentValueProperty, value);
  70. }
  71. }
  72. }
  73. }