LoaderControl.xaml.cs 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using OpenSEMI.ClientBase;
  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. using static CyberX8_Themes.UserControls.PufControl;
  17. namespace CyberX8_Themes.UserControls
  18. {
  19. /// <summary>
  20. /// LoaderControl.xaml 的交互逻辑
  21. /// </summary>
  22. public partial class LoaderControl : UserControl
  23. {
  24. public enum LoaderRotation
  25. {
  26. TrnpA = 0,
  27. TrnpB = 1,
  28. Load = 2,
  29. Camera = 3,
  30. ServiceB = 4
  31. }
  32. public LoaderControl()
  33. {
  34. InitializeComponent();
  35. }
  36. public static readonly DependencyProperty WaferVisibleAProperty = DependencyProperty.Register("WaferVisibleA", typeof(bool), typeof(LoaderControl));
  37. public bool WaferVisibleA
  38. {
  39. get { return (bool)this.GetValue(WaferVisibleAProperty); }
  40. set { this.SetValue(WaferVisibleAProperty, value); }
  41. }
  42. public static readonly DependencyProperty WaferVisibleBProperty = DependencyProperty.Register("WaferVisibleB", typeof(bool), typeof(LoaderControl));
  43. public bool WaferVisibleB
  44. {
  45. get { return (bool)this.GetValue(WaferVisibleBProperty); }
  46. set { this.SetValue(WaferVisibleBProperty, value); }
  47. }
  48. public static readonly DependencyProperty LoaderWaferAProperty = DependencyProperty.Register("LoaderWaferA", typeof(WaferInfo), typeof(LoaderControl));
  49. public WaferInfo LoaderWaferA
  50. {
  51. get => (WaferInfo)GetValue(LoaderWaferAProperty);
  52. set => SetValue(LoaderWaferAProperty, value);
  53. }
  54. public static readonly DependencyProperty LoaderWaferBProperty = DependencyProperty.Register("LoaderWaferB", typeof(WaferInfo), typeof(LoaderControl));
  55. public WaferInfo LoaderWaferB
  56. {
  57. get => (WaferInfo)GetValue(LoaderWaferBProperty);
  58. set => SetValue(LoaderWaferBProperty, value);
  59. }
  60. /// <summary>
  61. /// Load Rotation位置
  62. /// </summary>
  63. public static readonly DependencyProperty CurrentRotationProperty = DependencyProperty.Register("CurrentRotation", typeof(LoaderRotation), typeof(LoaderControl),
  64. new PropertyMetadata(LoaderRotation.TrnpA, RotationChangedCallback));
  65. public LoaderRotation CurrentRotation
  66. {
  67. get { return (LoaderRotation)this.GetValue(CurrentRotationProperty); }
  68. set
  69. {
  70. this.SetValue(CurrentRotationProperty, value);
  71. }
  72. }
  73. //Looader Rotation动画触发
  74. private static void RotationChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
  75. {
  76. var newAct = (LoaderRotation)e.NewValue;
  77. var control = d as LoaderControl;
  78. GoToRotation(control, newAct);
  79. }
  80. private static void GoToRotation(Control control, LoaderRotation rotation)
  81. {
  82. VisualStateManager.GoToElementState(control, rotation.ToString(), false);
  83. }
  84. }
  85. }