ExhaustPipe.xaml.cs 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using MECF.Framework.Common.DBCore;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. namespace CyberX8_Themes.UserControls
  17. {
  18. /// <summary>
  19. /// ExhaustPipe.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class ExhaustPipe : UserControl
  22. {
  23. public ExhaustPipe()
  24. {
  25. InitializeComponent();
  26. }
  27. public static readonly DependencyProperty FCornerRadiusProperty = DependencyProperty.Register(
  28. "FCornerRadius", typeof(CornerRadius), typeof(ExhaustPipe),
  29. new FrameworkPropertyMetadata(new CornerRadius(2), FrameworkPropertyMetadataOptions.AffectsRender));
  30. public static readonly DependencyProperty IsFlowingProperty = DependencyProperty.Register(
  31. "IsFlowing", typeof(bool), typeof(ExhaustPipe),
  32. new FrameworkPropertyMetadata(false, new PropertyChangedCallback(ItemSourceChanged)));
  33. public static readonly DependencyProperty FlowColorProperty = DependencyProperty.Register(
  34. "FlowColor", typeof(string), typeof(ExhaustPipe),
  35. new FrameworkPropertyMetadata("Gray", FrameworkPropertyMetadataOptions.AffectsRender));
  36. public static readonly DependencyProperty RotateTransformValueProperty = DependencyProperty.Register(
  37. "RotateTransformValue", typeof(int), typeof(ExhaustPipe));
  38. public static readonly DependencyProperty IsReverseProperty = DependencyProperty.Register(
  39. "IsReverse", typeof(bool), typeof(ExhaustPipe),
  40. new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
  41. public int RotateTransformValue
  42. {
  43. get { return (int)this.GetValue(RotateTransformValueProperty); }
  44. set { this.SetValue(RotateTransformValueProperty, value); }
  45. }
  46. public bool IsFlowing
  47. {
  48. get { return (bool)this.GetValue(IsFlowingProperty); }
  49. set { this.SetValue(IsFlowingProperty, value); }
  50. }
  51. public string FlowColor
  52. {
  53. get { return (string)this.GetValue(FlowColorProperty); }
  54. set { this.SetValue(FlowColorProperty, value); }
  55. }
  56. public bool IsReverse
  57. {
  58. get { return (bool)this.GetValue(IsReverseProperty); }
  59. set { this.SetValue(IsReverseProperty, value); }
  60. }
  61. public CornerRadius FCornerRadius
  62. {
  63. get { return (CornerRadius)this.GetValue(FCornerRadiusProperty); }
  64. set { this.SetValue(FCornerRadiusProperty, value); }
  65. }
  66. public bool IsVertical { get; set; }
  67. protected override void OnRender(DrawingContext drawingContext)
  68. {
  69. base.OnRender(drawingContext);
  70. }
  71. private static void ItemSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
  72. {
  73. if (e.NewValue != null && (bool)e.NewValue == true)
  74. {
  75. d.SetValue(FlowColorProperty, "Pink");
  76. }
  77. else
  78. {
  79. d.SetValue(FlowColorProperty, "Gray");
  80. }
  81. }
  82. }
  83. }