终端一体化运控平台
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

113 wiersze
3.5 KiB

  1. using BPASmartClient.Compiler;
  2. using Newtonsoft.Json;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.Collections.ObjectModel;
  7. using System.ComponentModel;
  8. using System.Drawing.Design;
  9. using System.Linq;
  10. using System.Reflection;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows;
  14. using System.Windows.Controls;
  15. using System.Windows.Data;
  16. using System.Windows.Documents;
  17. using System.Windows.Input;
  18. using System.Windows.Media;
  19. using System.Windows.Media.Animation;
  20. using System.Windows.Media.Imaging;
  21. using System.Windows.Navigation;
  22. using System.Windows.Shapes;
  23. using System.Windows.Threading;
  24. namespace BPASmartClient.SCADAControl.CustomerControls
  25. {
  26. /// <summary>
  27. /// TheWuLiaoControl.xaml 的交互逻辑
  28. /// </summary>
  29. public partial class TheWuLiaoControl : UserControl, IExecutable, IDisposable
  30. {
  31. public TheWuLiaoControl()
  32. {
  33. InitializeComponent();
  34. vs.Add(new shujuModel
  35. {
  36. name = "",
  37. dataModel = new ObservableCollection<string> { "", "" }
  38. });
  39. vs.Add(new shujuModel
  40. {
  41. name = "",
  42. dataModel = new ObservableCollection<string> { "", "", "", "" }
  43. });
  44. Width = 200;
  45. Height = 200;
  46. }
  47. public string ControlType => "物料仓";
  48. private bool isExecuteState;
  49. public bool IsExecuteState
  50. {
  51. get { return isExecuteState; }
  52. set
  53. {
  54. isExecuteState = value;
  55. if (IsExecuteState)
  56. {
  57. IsEnabled = true;
  58. Register();
  59. }
  60. }
  61. }
  62. public event EventHandler PropertyChange; //声明一个事件
  63. /// <summary>
  64. /// 数据模板
  65. /// </summary>
  66. private ObservableCollection<shujuModel> vs
  67. {
  68. get { return (ObservableCollection<shujuModel>)GetValue(vsProperty); }
  69. set { SetValue(vsProperty, value); }
  70. }
  71. private static readonly DependencyProperty vsProperty =
  72. DependencyProperty.Register("vs", typeof(ObservableCollection<shujuModel>), typeof(TheWuLiaoControl), new PropertyMetadata(new ObservableCollection<shujuModel>()));
  73. /// <summary>
  74. /// 数据模板
  75. /// </summary>
  76. private Dictionary<string, object> DataModel
  77. {
  78. get { return (Dictionary<string, object>)GetValue(DataModelProperty); }
  79. set { SetValue(DataModelProperty, value); }
  80. }
  81. private static readonly DependencyProperty DataModelProperty =
  82. DependencyProperty.Register("DataModel", typeof(Dictionary<string, object>), typeof(TheWuLiaoControl), new PropertyMetadata(new Dictionary<string, object>()));
  83. public void Register()
  84. {
  85. Class_DataBus.GetInstance().BindingAction += BindingActionHeader;
  86. }
  87. public void BindingActionHeader(object sender, EventArgs e)
  88. {
  89. this.Dispatcher.Invoke((Action)(() =>
  90. {
  91. DataModel = Class_DataBus.GetInstance().Dic_RedisDataBinding;
  92. PropertyChange?.Invoke(this, EventArgs.Empty);
  93. }));
  94. }
  95. public void Dispose()
  96. {
  97. }
  98. }
  99. public class shujuModel
  100. {
  101. public string name { get; set; }
  102. public ObservableCollection<string> dataModel { get; set; }
  103. }
  104. }