UserDeviceUnitControl.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using Sunny.UI;
  11. namespace Scada
  12. {
  13. public partial class UserDeviceUnitControl : UIUserControl
  14. {
  15. public UserDeviceUnitControl()
  16. {
  17. InitializeComponent();
  18. }
  19. private string equipmentUnitName = "设备单元";
  20. [Browsable(true)]//使属性可以暴露出来,显示到窗口中
  21. [Category("自定义属性")]//自定义属性
  22. [Description("设备单元的名称")]
  23. public string EquipmentUnitName
  24. {
  25. get { return equipmentUnitName; }
  26. set
  27. {
  28. equipmentUnitName = value;
  29. this.lbl_DeviceName.Text = equipmentUnitName;
  30. }
  31. }
  32. private bool state;
  33. [Browsable(true)]//使属性可以暴露出来,显示到窗口中
  34. [Category("自定义属性")]//自定义属性
  35. [Description("设备状态")]
  36. public bool State
  37. {
  38. get
  39. {
  40. state = this.sw_Device.Active;
  41. return state;
  42. }
  43. set
  44. {
  45. state = value;
  46. this.sw_Device.Active = state;
  47. }
  48. }
  49. private string openVariableName = "";
  50. [Browsable(true)]//使属性可以暴露出来,显示到窗口中
  51. [Category("自定义属性")]//自定义属性
  52. [Description("获取变量名称")]
  53. public string OpenVariableName
  54. {
  55. get { return openVariableName; }
  56. set { openVariableName = value; }
  57. }
  58. private string closeVariableName = "";
  59. [Browsable(true)]//使属性可以暴露出来,显示到窗口中
  60. [Category("自定义属性")]//自定义属性
  61. [Description("获取变量名称")]
  62. public string CloseVariableName
  63. {
  64. get { return closeVariableName; }
  65. set { closeVariableName = value; }
  66. }
  67. [Browsable(true)]
  68. [Category("自定义事件")]
  69. [Description("点击事件")]
  70. public event EventHandler ClickEvent;
  71. private void sw_Device_Click(object sender, EventArgs e)
  72. {
  73. ClickEvent?.Invoke(this, e);
  74. }
  75. }
  76. }