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

113 regels
3.5 KiB

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