ReserviorControl.xaml.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using MECF.Framework.Common.ProcessCell;
  2. using MECF.Framework.Common.Reservior;
  3. using CyberX8_Core;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Input;
  14. using System.Windows.Media;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Navigation;
  17. using System.Windows.Shapes;
  18. namespace CyberX8_Themes.UserControls
  19. {
  20. /// <summary>
  21. /// ReserviorControl.xaml 的交互逻辑
  22. /// </summary>
  23. public partial class ReserviorControl : UserControl
  24. {
  25. public ReserviorControl()
  26. {
  27. InitializeComponent();
  28. }
  29. public static readonly DependencyProperty ReserviorWidthProperty = DependencyProperty.Register("ReserviorWidth", typeof(int), typeof(ReserviorControl));
  30. /// <summary>
  31. /// 宽度
  32. /// </summary>
  33. public int ReserviorWidth
  34. {
  35. get
  36. {
  37. return (int)this.GetValue(ReserviorWidthProperty);
  38. }
  39. set
  40. {
  41. this.SetValue(ReserviorWidthProperty, value);
  42. }
  43. }
  44. public static readonly DependencyProperty ReserviorNameProperty = DependencyProperty.Register("ReserviorName", typeof(string), typeof(ReserviorControl));
  45. /// <summary>
  46. /// 名称
  47. /// </summary>
  48. public string ReserviorName
  49. {
  50. get
  51. {
  52. return (string)this.GetValue(ReserviorNameProperty);
  53. }
  54. set
  55. {
  56. this.SetValue(ReserviorNameProperty, value);
  57. }
  58. }
  59. public static readonly DependencyProperty ReserviorInfoProperty = DependencyProperty.Register("ReserviorInfo", typeof(ReserviorInfo), typeof(ReserviorControl),
  60. new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
  61. /// <summary>
  62. /// Reservior对象
  63. /// </summary>
  64. public ReserviorInfo ReserviorInfo
  65. {
  66. get
  67. {
  68. return (ReserviorInfo)this.GetValue(ReserviorInfoProperty);
  69. }
  70. set
  71. {
  72. this.SetValue(ReserviorInfoProperty, value);
  73. }
  74. }
  75. public static readonly DependencyProperty ReserviorStatusProperty = DependencyProperty.Register(
  76. "ReserviorStatus", typeof(int), typeof(ReserviorControl), new FrameworkPropertyMetadata((int)CellStatus.Idle, FrameworkPropertyMetadataOptions.AffectsRender));
  77. /// <summary>
  78. /// ReserviorStatus
  79. /// </summary>
  80. public int ReserviorStatus
  81. {
  82. get
  83. {
  84. return (int)this.GetValue(ReserviorStatusProperty);
  85. }
  86. set
  87. {
  88. this.SetValue(ReserviorStatusProperty, value);
  89. }
  90. }
  91. private void Canvas_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  92. {
  93. GlobalEvents.OnSwitchFixedTabItem("HardWare", "Reservoirs", $"{ReserviorName}");
  94. }
  95. }
  96. }