终端一体化运控平台
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

110 Zeilen
3.3 KiB

  1. using BPASmartClient.Compiler;
  2. using BPASmartClient.SCADAControl.Windows;
  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. /// TheMessage.xaml 的交互逻辑
  22. /// </summary>
  23. public partial class TheMessage : UserControl, IExecutable
  24. {
  25. public event EventHandler PropertyChange; //声明一个事件
  26. public string ControlType => "控件";
  27. private bool isExecuteState;
  28. public bool IsExecuteState
  29. {
  30. get { return isExecuteState; }
  31. set
  32. {
  33. isExecuteState = value;
  34. if (IsExecuteState)
  35. {
  36. Register();
  37. }
  38. }
  39. }
  40. public TheMessage()
  41. {
  42. InitializeComponent();
  43. Width = 40;
  44. Height = 40;
  45. }
  46. public void Register()
  47. {
  48. }
  49. #region 弹窗属性
  50. [Category("消息类型")]
  51. public MessageBoxStyle MessageLX
  52. {
  53. get { return (MessageBoxStyle)GetValue(MessageLXProperty); }
  54. set { SetValue(MessageLXProperty, value); }
  55. }
  56. public static readonly DependencyProperty MessageLXProperty =
  57. DependencyProperty.Register("MessageLX", typeof(MessageBoxStyle), typeof(TheMessage), new PropertyMetadata(MessageBoxStyle.info));
  58. [Category("消息数据")]
  59. public string Message
  60. {
  61. get { return (string)GetValue(MessageProperty); }
  62. set
  63. {
  64. SetValue(MessageProperty, value);
  65. MessageDataRefresh();
  66. }
  67. }
  68. public static readonly DependencyProperty MessageProperty =
  69. DependencyProperty.Register("Message", typeof(string), typeof(TheMessage), new PropertyMetadata(string.Empty));
  70. [Category("消息数据")]
  71. public bool ReturnValue
  72. {
  73. get { return (bool)GetValue(ReturnValueProperty); }
  74. set
  75. {
  76. SetValue(ReturnValueProperty, value);
  77. }
  78. }
  79. public static readonly DependencyProperty ReturnValueProperty =
  80. DependencyProperty.Register("ReturnValue", typeof(bool), typeof(TheMessage), new PropertyMetadata(false));
  81. public void MessageDataRefresh()
  82. {
  83. try
  84. {
  85. if (!string.IsNullOrEmpty(Message))
  86. {
  87. if (MessageBoxStyle.question == MessageLX)
  88. {
  89. ReturnValue = false;
  90. bool? bo= new MyMessageBox(MessageLX, Message).ShowDialog();
  91. ReturnValue=bo.Value;
  92. }
  93. else
  94. {
  95. new MyMessageBox(MessageLX, Message).ShowDialog();
  96. }
  97. }
  98. }
  99. catch (Exception ex)
  100. {
  101. }
  102. }
  103. #endregion
  104. }
  105. }