|
- using BPASmartClient.Compiler;
-
- using Newtonsoft.Json;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.ComponentModel;
- using System.Drawing.Design;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Animation;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using System.Windows.Threading;
-
-
- namespace BPASmartClient.SCADAControl.CustomerControls
- {
- /// <summary>
- /// TheWuLiaoControl.xaml 的交互逻辑
- /// </summary>
- public partial class TheWuLiaoControl : UserControl, IExecutable, IDisposable
- {
- public TheWuLiaoControl()
- {
- InitializeComponent();
- vs.Add(new shujuModel
- {
- name = "",
- dataModel = new ObservableCollection<string> { "", "" }
- });
- vs.Add(new shujuModel
- {
- name = "",
- dataModel = new ObservableCollection<string> { "", "", "", "" }
- });
- Width = 200;
- Height = 200;
- }
-
- public string ControlType => "物料仓";
- private bool isExecuteState;
- public bool IsExecuteState
- {
- get { return isExecuteState; }
- set
- {
- isExecuteState = value;
- if (IsExecuteState)
- {
- IsEnabled = true;
- Register();
- }
- }
- }
- public event EventHandler PropertyChange; //声明一个事件
- /// <summary>
- /// 数据模板
- /// </summary>
- private ObservableCollection<shujuModel> vs
- {
- get { return (ObservableCollection<shujuModel>)GetValue(vsProperty); }
- set { SetValue(vsProperty, value); }
- }
- private static readonly DependencyProperty vsProperty =
- DependencyProperty.Register("vs", typeof(ObservableCollection<shujuModel>), typeof(TheWuLiaoControl), new PropertyMetadata(new ObservableCollection<shujuModel>()));
- /// <summary>
- /// 数据模板
- /// </summary>
- private Dictionary<string, object> DataModel
- {
- get { return (Dictionary<string, object>)GetValue(DataModelProperty); }
- set { SetValue(DataModelProperty, value); }
- }
- private static readonly DependencyProperty DataModelProperty =
- DependencyProperty.Register("DataModel", typeof(Dictionary<string, object>), typeof(TheWuLiaoControl), new PropertyMetadata(new Dictionary<string, object>()));
- public void Register()
- {
- Class_DataBus.GetInstance().BindingAction += BindingActionHeader;
- }
-
- public void BindingActionHeader(object sender, EventArgs e)
- {
- this.Dispatcher.Invoke((Action)(() =>
- {
- DataModel = Class_DataBus.GetInstance().Dic_RedisDataBinding;
- PropertyChange?.Invoke(this, EventArgs.Empty);
- }));
- }
- public void Dispose()
- {
-
- }
-
- }
-
- public class shujuModel
- {
- public string name { get; set; }
- public ObservableCollection<string> dataModel { get; set; }
- }
- }
|