CirclePointRingLoading.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. using System.Windows;
  2. using System.Windows.Controls;
  3. namespace MECF.Framework.UI.Client.ClientBase.UserControls
  4. {
  5. [TemplateVisualState(Name = "Large", GroupName = "SizeStates")]
  6. [TemplateVisualState(Name = "Small", GroupName = "SizeStates")]
  7. [TemplateVisualState(Name = "Inactive", GroupName = "ActiveStates")]
  8. [TemplateVisualState(Name = "Active", GroupName = "ActiveStates")]
  9. public class CirclePointRingLoading : Control
  10. {
  11. // Token: 0x17000001 RID: 1
  12. // (get) Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
  13. // (set) Token: 0x06000002 RID: 2 RVA: 0x00002072 File Offset: 0x00000272
  14. public double BindableWidth
  15. {
  16. get => (double)base.GetValue(CirclePointRingLoading.BindableWidthProperty);
  17. private set => base.SetValue(CirclePointRingLoading.BindableWidthProperty, value);
  18. }
  19. // Token: 0x06000003 RID: 3 RVA: 0x00002088 File Offset: 0x00000288
  20. private static void BindableWidthCallback(DependencyObject dependencyObject,
  21. DependencyPropertyChangedEventArgs e)
  22. {
  23. var circlePointRingLoading = dependencyObject as CirclePointRingLoading;
  24. var flag = circlePointRingLoading == null;
  25. if (!flag)
  26. {
  27. circlePointRingLoading.SetEllipseDiameter((double)e.NewValue);
  28. circlePointRingLoading.SetEllipseOffset((double)e.NewValue);
  29. circlePointRingLoading.SetMaxSideLength((double)e.NewValue);
  30. }
  31. }
  32. // Token: 0x06000004 RID: 4 RVA: 0x000020E0 File Offset: 0x000002E0
  33. private void SetEllipseDiameter(double width)
  34. {
  35. this.EllipseDiameter = width / 8.0;
  36. }
  37. // Token: 0x06000005 RID: 5 RVA: 0x000020F5 File Offset: 0x000002F5
  38. private void SetEllipseOffset(double width)
  39. {
  40. this.EllipseOffset = new Thickness(0.0, width / 2.0, 0.0, 0.0);
  41. }
  42. // Token: 0x06000006 RID: 6 RVA: 0x0000212A File Offset: 0x0000032A
  43. private void SetMaxSideLength(double width)
  44. {
  45. this.MaxSideLength = ((width <= 20.0) ? 20.0 : width);
  46. }
  47. // Token: 0x17000002 RID: 2
  48. // (get) Token: 0x06000007 RID: 7 RVA: 0x0000214C File Offset: 0x0000034C
  49. // (set) Token: 0x06000008 RID: 8 RVA: 0x0000216E File Offset: 0x0000036E
  50. public bool IsActive
  51. {
  52. get => (bool)base.GetValue(CirclePointRingLoading.IsActiveProperty);
  53. set => base.SetValue(CirclePointRingLoading.IsActiveProperty, value);
  54. }
  55. // Token: 0x06000009 RID: 9 RVA: 0x00002184 File Offset: 0x00000384
  56. private static void IsActiveChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
  57. {
  58. var circlePointRingLoading = sender as CirclePointRingLoading;
  59. var flag = circlePointRingLoading == null;
  60. if (!flag)
  61. {
  62. circlePointRingLoading.UpdateActiveState();
  63. }
  64. }
  65. // Token: 0x0600000A RID: 10 RVA: 0x000021AC File Offset: 0x000003AC
  66. private void UpdateActiveState()
  67. {
  68. var isActive = this.IsActive;
  69. if (isActive)
  70. {
  71. VisualStateManager.GoToState(this, this.StateActive, true);
  72. }
  73. else
  74. {
  75. VisualStateManager.GoToState(this, this.StateInActive, true);
  76. }
  77. }
  78. // Token: 0x17000003 RID: 3
  79. // (get) Token: 0x0600000B RID: 11 RVA: 0x000021E4 File Offset: 0x000003E4
  80. // (set) Token: 0x0600000C RID: 12 RVA: 0x00002206 File Offset: 0x00000406
  81. public bool IsLarge
  82. {
  83. get => (bool)base.GetValue(CirclePointRingLoading.IsLargeProperty);
  84. set => base.SetValue(CirclePointRingLoading.IsLargeProperty, value);
  85. }
  86. // Token: 0x0600000D RID: 13 RVA: 0x0000221C File Offset: 0x0000041C
  87. private static void IsLargeChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
  88. {
  89. var circlePointRingLoading = sender as CirclePointRingLoading;
  90. var flag = circlePointRingLoading == null;
  91. if (!flag)
  92. {
  93. circlePointRingLoading.UpdateLargeState();
  94. }
  95. }
  96. // Token: 0x0600000E RID: 14 RVA: 0x00002244 File Offset: 0x00000444
  97. private void UpdateLargeState()
  98. {
  99. var isLarge = this.IsLarge;
  100. if (isLarge)
  101. {
  102. VisualStateManager.GoToState(this, this.StateLarge, true);
  103. }
  104. else
  105. {
  106. VisualStateManager.GoToState(this, this.StateSmall, true);
  107. }
  108. }
  109. // Token: 0x17000004 RID: 4
  110. // (get) Token: 0x0600000F RID: 15 RVA: 0x0000227C File Offset: 0x0000047C
  111. // (set) Token: 0x06000010 RID: 16 RVA: 0x0000229E File Offset: 0x0000049E
  112. public double MaxSideLength
  113. {
  114. get => (double)base.GetValue(CirclePointRingLoading.MaxSideLengthProperty);
  115. set => base.SetValue(CirclePointRingLoading.MaxSideLengthProperty, value);
  116. }
  117. // Token: 0x17000005 RID: 5
  118. // (get) Token: 0x06000011 RID: 17 RVA: 0x000022B4 File Offset: 0x000004B4
  119. // (set) Token: 0x06000012 RID: 18 RVA: 0x000022D6 File Offset: 0x000004D6
  120. public double EllipseDiameter
  121. {
  122. get => (double)base.GetValue(CirclePointRingLoading.EllipseDiameterProperty);
  123. set => base.SetValue(CirclePointRingLoading.EllipseDiameterProperty, value);
  124. }
  125. // Token: 0x17000006 RID: 6
  126. // (get) Token: 0x06000013 RID: 19 RVA: 0x000022EC File Offset: 0x000004EC
  127. // (set) Token: 0x06000014 RID: 20 RVA: 0x0000230E File Offset: 0x0000050E
  128. public Thickness EllipseOffset
  129. {
  130. get => (Thickness)base.GetValue(CirclePointRingLoading.EllipseOffsetProperty);
  131. set => base.SetValue(CirclePointRingLoading.EllipseOffsetProperty, value);
  132. }
  133. // Token: 0x06000015 RID: 21 RVA: 0x00002324 File Offset: 0x00000524
  134. public CirclePointRingLoading()
  135. {
  136. base.SizeChanged += new SizeChangedEventHandler((object argument0, SizeChangedEventArgs argument1) =>
  137. this.BindableWidth = base.ActualWidth);
  138. }
  139. // Token: 0x06000016 RID: 22 RVA: 0x00002378 File Offset: 0x00000578
  140. static CirclePointRingLoading()
  141. {
  142. FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(CirclePointRingLoading),
  143. new FrameworkPropertyMetadata(typeof(CirclePointRingLoading)));
  144. UIElement.VisibilityProperty.OverrideMetadata(typeof(CirclePointRingLoading), new FrameworkPropertyMetadata(
  145. delegate (DependencyObject ringObject, DependencyPropertyChangedEventArgs e)
  146. {
  147. var flag = e.NewValue != e.OldValue;
  148. if (flag)
  149. {
  150. var circlePointRingLoading = (CirclePointRingLoading)ringObject;
  151. var flag2 = (Visibility)e.NewValue > Visibility.Visible;
  152. if (flag2)
  153. {
  154. circlePointRingLoading.SetCurrentValue(CirclePointRingLoading.IsActiveProperty, false);
  155. }
  156. else
  157. {
  158. circlePointRingLoading.IsActive = true;
  159. }
  160. }
  161. }));
  162. }
  163. // Token: 0x06000017 RID: 23 RVA: 0x00002531 File Offset: 0x00000731
  164. public override void OnApplyTemplate()
  165. {
  166. base.OnApplyTemplate();
  167. this.UpdateLargeState();
  168. this.UpdateActiveState();
  169. }
  170. // Token: 0x04000001 RID: 1
  171. private string StateActive = "Active";
  172. // Token: 0x04000002 RID: 2
  173. private string StateInActive = "InActive";
  174. // Token: 0x04000003 RID: 3
  175. private string StateLarge = "Large";
  176. // Token: 0x04000004 RID: 4
  177. private string StateSmall = "Small";
  178. // Token: 0x04000005 RID: 5
  179. public static readonly DependencyProperty BindableWidthProperty = DependencyProperty.Register("BindableWidth",
  180. typeof(double), typeof(CirclePointRingLoading),
  181. new PropertyMetadata(0.0, new PropertyChangedCallback(CirclePointRingLoading.BindableWidthCallback)));
  182. // Token: 0x04000006 RID: 6
  183. public static readonly DependencyProperty IsActiveProperty = DependencyProperty.Register("IsActive",
  184. typeof(bool), typeof(CirclePointRingLoading),
  185. new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
  186. new PropertyChangedCallback(CirclePointRingLoading.IsActiveChanged)));
  187. // Token: 0x04000007 RID: 7
  188. public static readonly DependencyProperty IsLargeProperty = DependencyProperty.Register("IsLarge", typeof(bool),
  189. typeof(CirclePointRingLoading),
  190. new PropertyMetadata(true, new PropertyChangedCallback(CirclePointRingLoading.IsLargeChangedCallback)));
  191. // Token: 0x04000008 RID: 8
  192. public static readonly DependencyProperty MaxSideLengthProperty = DependencyProperty.Register("MaxSideLength",
  193. typeof(double), typeof(CirclePointRingLoading), new PropertyMetadata(0.0));
  194. // Token: 0x04000009 RID: 9
  195. public static readonly DependencyProperty EllipseDiameterProperty =
  196. DependencyProperty.Register("EllipseDiameter", typeof(double), typeof(CirclePointRingLoading),
  197. new PropertyMetadata(0.0));
  198. // Token: 0x0400000A RID: 10
  199. public static readonly DependencyProperty EllipseOffsetProperty = DependencyProperty.Register("EllipseOffset",
  200. typeof(Thickness), typeof(CirclePointRingLoading), new PropertyMetadata(default(Thickness)));
  201. }
  202. }