StateTitle.xaml.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. using System.Windows;
  2. using System.Windows.Controls;
  3. using System.Windows.Media;
  4. using Venus_Themes.Unity;
  5. namespace Venus_Themes.UserControls
  6. {
  7. /// <summary>
  8. /// StateTitle.xaml 的交互逻辑
  9. /// </summary>
  10. public partial class StateTitle : UserControl
  11. {
  12. public StateTitle()
  13. {
  14. InitializeComponent();
  15. }
  16. public static readonly DependencyProperty LabelColorProperty = DependencyProperty.Register(
  17. "LabelColor", typeof(SolidColorBrush), typeof(StateTitle), new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#838B83"))));
  18. public SolidColorBrush LabelColor
  19. {
  20. get { return (SolidColorBrush)this.GetValue(LabelColorProperty); }
  21. set { this.SetValue(LabelColorProperty, value); }
  22. }
  23. public static readonly DependencyProperty TextBoxColorProperty = DependencyProperty.Register(
  24. "TextBoxColor", typeof(SolidColorBrush), typeof(StateTitle));
  25. public SolidColorBrush TextBoxColor
  26. {
  27. get { return (SolidColorBrush)this.GetValue(TextBoxColorProperty); }
  28. set { this.SetValue(TextBoxColorProperty, value); }
  29. }
  30. public static readonly DependencyProperty TextBoxValueProperty = DependencyProperty.Register(
  31. "TextBoxValue", typeof(string), typeof(StateTitle));
  32. public string TextBoxValue
  33. {
  34. get { return (string)this.GetValue(TextBoxValueProperty); }
  35. set { this.SetValue(TextBoxValueProperty, value); }
  36. }
  37. public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(
  38. "Title", typeof(string), typeof(StateTitle));
  39. public string Title
  40. {
  41. get { return (string)this.GetValue(TitleProperty); }
  42. set { this.SetValue(TitleProperty, value); }
  43. }
  44. public static readonly DependencyProperty UpItemProperty = DependencyProperty.Register(
  45. "UpItem", typeof(string), typeof(StateTitle),new PropertyMetadata("Online"));
  46. public string UpItem
  47. {
  48. get { return (string)this.GetValue(UpItemProperty); }
  49. set { this.SetValue(UpItemProperty, value); }
  50. }
  51. public static readonly DependencyProperty DownItemProperty = DependencyProperty.Register(
  52. "DownItem", typeof(string), typeof(StateTitle), new PropertyMetadata("Offline"));
  53. public string DownItem
  54. {
  55. get { return (string)this.GetValue(DownItemProperty); }
  56. set { this.SetValue(DownItemProperty, value); }
  57. }
  58. public static readonly DependencyProperty IsIncludeProperty = DependencyProperty.Register(
  59. "IsInclude", typeof(bool), typeof(StateTitle));
  60. public bool IsInclude
  61. {
  62. get
  63. {
  64. return (bool)this.GetValue(IsIncludeProperty);
  65. }
  66. set
  67. {
  68. this.SetValue(IsIncludeProperty, value);
  69. }
  70. }
  71. public static readonly DependencyProperty IsNeedIncludeProperty = DependencyProperty.Register(
  72. "IsNeedInclude", typeof(bool), typeof(StateTitle),new PropertyMetadata(true));
  73. public bool IsNeedInclude
  74. {
  75. get
  76. {
  77. return (bool)this.GetValue(IsNeedIncludeProperty);
  78. }
  79. set
  80. {
  81. this.SetValue(IsNeedIncludeProperty, value);
  82. }
  83. }
  84. public static readonly DependencyProperty IsNeedContextMenuProperty = DependencyProperty.Register(
  85. "IsNeedContextMenu", typeof(bool), typeof(StateTitle), new PropertyMetadata(true));
  86. public bool IsNeedContextMenu
  87. {
  88. get
  89. {
  90. return (bool)this.GetValue(IsNeedContextMenuProperty);
  91. }
  92. set
  93. {
  94. this.SetValue(IsNeedContextMenuProperty, value);
  95. }
  96. }
  97. public static readonly DependencyProperty IsOnlineProperty = DependencyProperty.Register(
  98. "IsOnline", typeof(bool), typeof(StateTitle));
  99. public bool IsOnline
  100. {
  101. get
  102. {
  103. return (bool)this.GetValue(IsOnlineProperty);
  104. }
  105. set
  106. {
  107. this.SetValue(IsOnlineProperty, value);
  108. }
  109. }
  110. public static readonly DependencyProperty IsCanAbortProperty = DependencyProperty.Register(
  111. "IsCanAbort", typeof(bool), typeof(StateTitle));
  112. public bool IsCanAbort
  113. {
  114. get
  115. {
  116. return (bool)this.GetValue(IsCanAbortProperty);
  117. }
  118. set
  119. {
  120. this.SetValue(IsCanAbortProperty, value);
  121. }
  122. }
  123. private void Initialize_Click(object sender, RoutedEventArgs e)
  124. {
  125. UIEvents.OnInitRaiseChanged(Title);
  126. }
  127. private void Abort_Click(object sender, RoutedEventArgs e)
  128. {
  129. UIEvents.OnAbortRaiseChanged(Title);
  130. }
  131. private void Exclude_Click(object sender, RoutedEventArgs e)
  132. {
  133. UIEvents.OnIncludeRaiseChanged(new IncludePara() { ModuleName = Title, IsInclude = false });
  134. }
  135. private void Include_Click(object sender, RoutedEventArgs e)
  136. {
  137. UIEvents.OnIncludeRaiseChanged(new IncludePara() { ModuleName = Title, IsInclude = true });
  138. }
  139. private void Online_Click(object sender, RoutedEventArgs e)
  140. {
  141. UIEvents.OnOnlineRaiseChanged(new IncludePara() { ModuleName = Title, IsInclude = true});
  142. }
  143. private void Offline_Click(object sender, RoutedEventArgs e)
  144. {
  145. UIEvents.OnOnlineRaiseChanged(new IncludePara() { ModuleName = Title, IsInclude = false });
  146. }
  147. }
  148. }