终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

91 rivejä
2.6 KiB

  1. using BPASmartClient.Compiler;
  2. using BPASmartClient.SCADAControl;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Input;
  14. using System.Windows.Media;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Navigation;
  17. using System.Windows.Shapes;
  18. namespace BPASmartClient.SCADAControl.CustomerControls
  19. {
  20. /// <summary>
  21. /// TheCheckBox.xaml 的交互逻辑
  22. /// </summary>
  23. public partial class TheCheckBox : CheckBox, IExecutable
  24. {
  25. public TheCheckBox()
  26. {
  27. InitializeComponent();
  28. Content = "勾选框";
  29. VerticalContentAlignment = VerticalAlignment.Center;
  30. }
  31. public string ControlType => "控件";
  32. private bool isExecuteState;
  33. public bool IsExecuteState
  34. {
  35. get { return isExecuteState; }
  36. set
  37. {
  38. isExecuteState = value;
  39. if (IsExecuteState)
  40. {
  41. Register();
  42. }
  43. }
  44. }
  45. /// <summary>
  46. /// 不勾选时执行代码
  47. /// </summary>
  48. [Category("事件")]
  49. public string UnCheckedExec
  50. {
  51. get { return (string)GetValue(UnCheckedExecProperty); }
  52. set { SetValue(UnCheckedExecProperty, value); }
  53. }
  54. public static readonly DependencyProperty UnCheckedExecProperty =
  55. DependencyProperty.Register("UnCheckedExec", typeof(string), typeof(TheCheckBox), new PropertyMetadata(string.Empty));
  56. /// <summary>
  57. /// 勾选时执行代码
  58. /// </summary>
  59. [Category("事件")]
  60. public string CheckedExec
  61. {
  62. get { return (string)GetValue(CheckedExecProperty); }
  63. set { SetValue(CheckedExecProperty, value); }
  64. }
  65. public static readonly DependencyProperty CheckedExecProperty =
  66. DependencyProperty.Register("CheckedExec", typeof(string), typeof(TheCheckBox), new PropertyMetadata(string.Empty));
  67. public void Register()
  68. {
  69. Checked += TheCheckBox_Checked;
  70. Unchecked += TheCheckBox_Unchecked;
  71. }
  72. private void TheCheckBox_Unchecked(object sender, RoutedEventArgs e)
  73. {
  74. Config.GetInstance().RunJsScipt(UnCheckedExec);
  75. }
  76. private void TheCheckBox_Checked(object sender, RoutedEventArgs e)
  77. {
  78. Config.GetInstance().RunJsScipt(CheckedExec);
  79. }
  80. }
  81. }