终端一体化运控平台
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.
 
 
 

74 lines
2.0 KiB

  1. using BPASmartClient.Compiler;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. namespace BPASmartClient.SCADAControl
  18. {
  19. /// <summary>
  20. /// TheButton.xaml 的交互逻辑
  21. /// </summary>
  22. public partial class TheButton : Button, IExecutable
  23. {
  24. public TheButton()
  25. {
  26. InitializeComponent();
  27. Content = "按钮";
  28. Width = 80;
  29. Height = 30;
  30. Style = Application.Current.Resources["DesignButton"] as Style;//FindResource("DesignButton") as Style;
  31. }
  32. public string ControlType => "控件";
  33. private bool isExecuteState;
  34. public bool IsExecuteState
  35. {
  36. get { return isExecuteState; }
  37. set
  38. {
  39. isExecuteState = value;
  40. if (IsExecuteState)
  41. {
  42. Style = null;
  43. Register();
  44. }
  45. }
  46. }
  47. [Category("事件")]
  48. public string ClickExec
  49. {
  50. get { return (string)GetValue(ClickExecProperty); }
  51. set { SetValue(ClickExecProperty, value); }
  52. }
  53. public static readonly DependencyProperty ClickExecProperty =
  54. DependencyProperty.Register("ClickExec", typeof(string), typeof(TheButton), new PropertyMetadata(string.Empty));
  55. /// <summary>
  56. /// 注册需要处理的事件
  57. /// </summary>
  58. public void Register()
  59. {
  60. this.Click += MyButton_Click;
  61. }
  62. private void MyButton_Click(object sender, RoutedEventArgs e)
  63. {
  64. Config.GetInstance().RunJsScipt(ClickExec);
  65. }
  66. }
  67. }