MyComboBoxItem.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. using System;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using System.Windows.Input;
  5. using Microsoft.VisualBasic.CompilerServices;
  6. namespace PCL
  7. {
  8. // Token: 0x0200001B RID: 27
  9. public class MyComboBoxItem : ComboBoxItem
  10. {
  11. // Token: 0x06000098 RID: 152 RVA: 0x0000E988 File Offset: 0x0000CB88
  12. public MyComboBoxItem()
  13. {
  14. base.Unselected += delegate(object sender, RoutedEventArgs e)
  15. {
  16. this.RefreshColor();
  17. };
  18. base.MouseMove += delegate(object sender, MouseEventArgs e)
  19. {
  20. this.RefreshColor();
  21. };
  22. base.MouseLeave += delegate(object sender, MouseEventArgs e)
  23. {
  24. this.RefreshColor();
  25. };
  26. base.Selected += delegate(object sender, RoutedEventArgs e)
  27. {
  28. this.RefreshColor();
  29. };
  30. base.IsEnabledChanged += delegate(object sender, DependencyPropertyChangedEventArgs e)
  31. {
  32. this.RefreshColor();
  33. };
  34. base.MouseLeftButtonUp += this.MyComboBoxItem_MouseLeftButtonUp;
  35. this.m_Map = ModBase.GetUuid();
  36. base.Style = (Style)base.FindResource("MyComboBoxItem");
  37. }
  38. // Token: 0x06000099 RID: 153 RVA: 0x0000EA2C File Offset: 0x0000CC2C
  39. private void RefreshColor()
  40. {
  41. string text;
  42. double num;
  43. int time;
  44. if (base.IsSelected)
  45. {
  46. text = "ColorBrush6";
  47. num = 1.0;
  48. time = 100;
  49. }
  50. else if (base.IsMouseOver)
  51. {
  52. text = "ColorBrush8";
  53. num = 1.0;
  54. time = 100;
  55. }
  56. else if (base.IsEnabled)
  57. {
  58. text = "ColorBrushTransparent";
  59. num = 1.0;
  60. time = 300;
  61. }
  62. else
  63. {
  64. text = "ColorBrushTransparent";
  65. num = 0.4;
  66. time = 300;
  67. }
  68. if (Operators.CompareString(this._Context, text, false) != 0 || this.m_Specification != num)
  69. {
  70. this._Context = text;
  71. this.m_Specification = num;
  72. if (base.IsLoaded && ModAnimation.CalcParser() == 0)
  73. {
  74. ModAnimation.AniStart(new ModAnimation.AniData[]
  75. {
  76. ModAnimation.AaColor(this, Control.BackgroundProperty, this._Context, time, 0, null, false),
  77. ModAnimation.AaOpacity(this, this.m_Specification - base.Opacity, time, 0, null, false)
  78. }, "ComboBoxItem Color " + Conversions.ToString(this.m_Map), false);
  79. return;
  80. }
  81. ModAnimation.AniStop("ComboBoxItem Color " + Conversions.ToString(this.m_Map));
  82. base.SetResourceReference(Control.BackgroundProperty, this._Context);
  83. base.Opacity = this.m_Specification;
  84. }
  85. }
  86. // Token: 0x0600009A RID: 154 RVA: 0x00002725 File Offset: 0x00000925
  87. public override string ToString()
  88. {
  89. return base.Content.ToString();
  90. }
  91. // Token: 0x0600009B RID: 155 RVA: 0x00002732 File Offset: 0x00000932
  92. public static implicit operator string(MyComboBoxItem Value)
  93. {
  94. return Value.Content.ToString();
  95. }
  96. // Token: 0x0600009C RID: 156 RVA: 0x0000273F File Offset: 0x0000093F
  97. private void MyComboBoxItem_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  98. {
  99. ModBase.Log("[Control] 选择下拉列表项:" + this.ToString(), ModBase.LogLevel.Normal, "出现错误");
  100. }
  101. // Token: 0x04000012 RID: 18
  102. public int m_Map;
  103. // Token: 0x04000013 RID: 19
  104. private string _Context;
  105. // Token: 0x04000014 RID: 20
  106. private double m_Specification;
  107. }
  108. }