From 29d14496736124fbd34f964894500c3783e351e6 Mon Sep 17 00:00:00 2001
From: fyf <11621@LAPTOP-04QQU0AO>
Date: Wed, 14 Sep 2022 15:34:35 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8F=AF=E8=A7=86=E5=8C=96?=
=?UTF-8?q?=E6=8E=A7=E4=BB=B6=E9=9B=86=E5=92=8C=E5=B1=9E=E6=80=A7=E7=BB=91?=
=?UTF-8?q?=E5=AE=9A=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
BPASmartClient.DATABUS/Class_DataBus.cs | 2 +-
.../BPASmartClient.SCADAControl.csproj | 80 +-
.../Converters/RelayCommandSimple.cs | 173 +++
.../Converters/Style3ArcConverter.cs | 59 +
.../CustomerControls/NumberBox.cs | 9 +-
.../CustomerControls/Silos.xaml | 1 -
.../CustomerControls/Silos.xaml.cs | 99 +-
.../CustomerControls/TheBlueProgressBar.cs | 63 +
.../CustomerControls/TheButton.xaml.cs | 82 +-
.../CustomerControls/TheCheckBox.xaml | 7 +
.../CustomerControls/TheComboBox.xaml.cs | 7 +-
.../CustomerControls/TheGreenProgressBar.cs | 64 +
.../CustomerControls/TheGroupBox.xaml.cs | 3 +
...TheTextBlock.xaml.cs => TheProgressBar.cs} | 24 +-
.../CustomerControls/TheRadioButton.cs | 3 +
.../CustomerControls/TheRedProgressBar.cs | 64 +
.../CustomerControls/TheRedis.xaml.cs | 51 +-
.../CustomerControls/TheTextBlock.cs | 128 ++
.../CustomerControls/TheTextBlock.xaml | 9 -
.../CustomerControls/TheTextBox.cs | 92 +-
.../CustomerControls/WaveProgressBar.cs | 3 +
BPASmartClient.SCADAControl/Images/2609.png | Bin 0 -> 313 bytes
.../Images/Cb_Checked.png | Bin 0 -> 257 bytes
.../Images/Cb_HalfChecked.png | Bin 0 -> 107 bytes
.../Images/btn_normal.png | Bin 0 -> 317 bytes
.../Images/button1.png | Bin 0 -> 274 bytes
.../Images/button2.png | Bin 0 -> 265 bytes
BPASmartClient.SCADAControl/Images/nbbj.png | Bin 0 -> 3653 bytes
.../Themes/Generic.xaml | 1282 ++++++++++++++++-
29 files changed, 2121 insertions(+), 184 deletions(-)
create mode 100644 BPASmartClient.SCADAControl/Converters/RelayCommandSimple.cs
create mode 100644 BPASmartClient.SCADAControl/Converters/Style3ArcConverter.cs
create mode 100644 BPASmartClient.SCADAControl/CustomerControls/TheBlueProgressBar.cs
create mode 100644 BPASmartClient.SCADAControl/CustomerControls/TheGreenProgressBar.cs
rename BPASmartClient.SCADAControl/CustomerControls/{TheTextBlock.xaml.cs => TheProgressBar.cs} (56%)
create mode 100644 BPASmartClient.SCADAControl/CustomerControls/TheRedProgressBar.cs
create mode 100644 BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.cs
delete mode 100644 BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.xaml
create mode 100644 BPASmartClient.SCADAControl/Images/2609.png
create mode 100644 BPASmartClient.SCADAControl/Images/Cb_Checked.png
create mode 100644 BPASmartClient.SCADAControl/Images/Cb_HalfChecked.png
create mode 100644 BPASmartClient.SCADAControl/Images/btn_normal.png
create mode 100644 BPASmartClient.SCADAControl/Images/button1.png
create mode 100644 BPASmartClient.SCADAControl/Images/button2.png
create mode 100644 BPASmartClient.SCADAControl/Images/nbbj.png
diff --git a/BPASmartClient.DATABUS/Class_DataBus.cs b/BPASmartClient.DATABUS/Class_DataBus.cs
index ade24c63..9c6d8b85 100644
--- a/BPASmartClient.DATABUS/Class_DataBus.cs
+++ b/BPASmartClient.DATABUS/Class_DataBus.cs
@@ -28,7 +28,7 @@ namespace BPASmartClient.DATABUS
///
/// 设备数据
///
- public ConcurrentDictionary Dic_DeviceData = new ConcurrentDictionary(); //原始目标链表
+ public ConcurrentDictionary> Dic_DeviceData = new ConcurrentDictionary>(); //原始目标链表
#endregion
}
}
\ No newline at end of file
diff --git a/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj b/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj
index 2e3e337d..129b4683 100644
--- a/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj
+++ b/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj
@@ -9,9 +9,16 @@
+
+
+
+
+
+
+
@@ -50,22 +57,69 @@
-
-
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
Always
-
-
-
-
-
-
-
-
-
-
-
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
diff --git a/BPASmartClient.SCADAControl/Converters/RelayCommandSimple.cs b/BPASmartClient.SCADAControl/Converters/RelayCommandSimple.cs
new file mode 100644
index 00000000..fb0e6a75
--- /dev/null
+++ b/BPASmartClient.SCADAControl/Converters/RelayCommandSimple.cs
@@ -0,0 +1,173 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Input;
+namespace BPASmartClient.SCADAControl.Converters
+{
+ public class RelayCommandSimple :ICommand, IDisposable
+ {
+ private Action _executeCallback;
+ private Func _canExecute;
+
+ public RelayCommandSimple(Action execute)
+ {
+ _executeCallback = execute;
+ }
+
+ public RelayCommandSimple(Action execute,Func canExecute)
+ : this(execute)
+ {
+ _canExecute = canExecute;
+ }
+
+ public bool CanExecute(object parameter)
+ {
+ if (_canExecute == null)
+ return true;
+ return _canExecute();
+ }
+
+ public void Execute(object parameter)
+ {
+ _executeCallback();
+ }
+
+ public void Dispose()
+ {
+ _executeCallback = null;
+ _canExecute = null;
+ }
+
+ public event EventHandler CanExecuteChanged
+ {
+ add
+ {
+ if (this._canExecute != null)
+ {
+ CommandManager.RequerySuggested += value;
+ }
+ }
+ remove
+ {
+ if (this._canExecute != null)
+ {
+ CommandManager.RequerySuggested -= value;
+ }
+ }
+ }
+ }
+
+ public class RelayCommandSimple :ICommand
+ {
+ private Action _executeCallback;
+ private Func _canExecute;
+
+ public RelayCommandSimple(Action execute)
+ {
+ if (execute == null)
+ throw new ArgumentNullException("execute");
+
+ _executeCallback = execute;
+ }
+
+ public RelayCommandSimple(Action execute,Func canExecute)
+ : this(execute)
+ {
+ _canExecute = canExecute;
+ }
+
+ public bool CanExecute(object parameter)
+ {
+ if (_canExecute == null)
+ return true;
+
+ if (parameter != null && parameter is TParam)
+ {
+ return _canExecute((TParam)parameter);
+ }
+ return true;
+ }
+
+ public void Execute(object parameter)
+ {
+ if (parameter != null && parameter is TParam)
+ {
+ _executeCallback((TParam)parameter);
+ }
+ }
+
+ public event EventHandler CanExecuteChanged
+ {
+ add
+ {
+ if (this._canExecute != null)
+ {
+ CommandManager.RequerySuggested += value;
+ }
+ }
+ remove
+ {
+ if (this._canExecute != null)
+ {
+ CommandManager.RequerySuggested -= value;
+ }
+ }
+ }
+ }
+
+
+ public class RelayCommandSimpleNull :ICommand
+ {
+ private Action _executeCallback;
+ private Func _canExecute;
+
+ public RelayCommandSimpleNull(Action execute)
+ {
+ if (execute == null)
+ throw new ArgumentNullException("execute");
+
+ _executeCallback = execute;
+ }
+
+ public RelayCommandSimpleNull(Action execute,Func canExecute)
+ : this(execute)
+ {
+ _canExecute = canExecute;
+ }
+
+ public bool CanExecute(object parameter)
+ {
+ if (_canExecute == null)
+ return true;
+
+
+ return _canExecute((T)parameter);
+
+ }
+
+ public void Execute(object parameter)
+ {
+ _executeCallback((T)parameter);
+ }
+
+ public event EventHandler CanExecuteChanged
+ {
+ add
+ {
+ if (this._canExecute != null)
+ {
+ CommandManager.RequerySuggested += value;
+ }
+ }
+ remove
+ {
+ if (this._canExecute != null)
+ {
+ CommandManager.RequerySuggested -= value;
+ }
+ }
+ }
+ }
+}
diff --git a/BPASmartClient.SCADAControl/Converters/Style3ArcConverter.cs b/BPASmartClient.SCADAControl/Converters/Style3ArcConverter.cs
new file mode 100644
index 00000000..f3bf6b74
--- /dev/null
+++ b/BPASmartClient.SCADAControl/Converters/Style3ArcConverter.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using System.Windows.Media;
+namespace BPASmartClient.SCADAControl.Converters
+{
+ public class Style3ArcConverter :IMultiValueConverter
+ {
+ public object Convert(object[] values,Type targetType,object parameter,CultureInfo culture)
+ {
+ double value = (double)values[0];
+ double thickness = (double)values[1];
+
+ double radius = 40;
+
+ double 周长 = Math.PI * (2 * radius - thickness) / thickness;
+
+ double showPrecent = value / 100 * 周长;
+
+ var converter = TypeDescriptor.GetConverter(typeof(DoubleCollection));
+
+ return (DoubleCollection)converter.ConvertFrom($"{showPrecent} {周长}");
+ }
+
+ public object[] ConvertBack(object value,Type[] targetTypes,object parameter,CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public class Style3DashConverter :IValueConverter
+ {
+ public object Convert(object value,Type targetType,object parameter,CultureInfo culture)
+ {
+ double v = (double)value;
+
+ if (v == 0)
+ {
+ return PenLineCap.Flat;
+ }
+ else
+ {
+ return PenLineCap.Round;
+ }
+
+ }
+
+ public object ConvertBack(object value,Type targetType,object parameter,CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+}
diff --git a/BPASmartClient.SCADAControl/CustomerControls/NumberBox.cs b/BPASmartClient.SCADAControl/CustomerControls/NumberBox.cs
index 75d78c2f..784e0df8 100644
--- a/BPASmartClient.SCADAControl/CustomerControls/NumberBox.cs
+++ b/BPASmartClient.SCADAControl/CustomerControls/NumberBox.cs
@@ -45,10 +45,13 @@ namespace BPASmartClient.SCADAControl.CustomerControls
Height = 30;
CurValue = 0.01;
Digits = 2;
-
+ FontSize = 16;
VerticalContentAlignment = VerticalAlignment.Center;
-
- Style = Application.Current.Resources["DesignNumberBox"] as Style;//FindResource("DesignNumberBox") as Style;
+ ResourceDictionary languageResDic = new ResourceDictionary();
+ languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
+ this.Resources.MergedDictionaries.Add(languageResDic);
+
+ //Style = Application.Current.Resources["DesignNumberBox"] as Style;//FindResource("DesignNumberBox") as Style;
this.TextChanged += NumberBox_TextChanged;
this.PreviewKeyDown += NumberBox_KeyDown;
diff --git a/BPASmartClient.SCADAControl/CustomerControls/Silos.xaml b/BPASmartClient.SCADAControl/CustomerControls/Silos.xaml
index 338cc6f7..c477af3a 100644
--- a/BPASmartClient.SCADAControl/CustomerControls/Silos.xaml
+++ b/BPASmartClient.SCADAControl/CustomerControls/Silos.xaml
@@ -74,7 +74,6 @@
-
diff --git a/BPASmartClient.SCADAControl/CustomerControls/Silos.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/Silos.xaml.cs
index 74afeb63..e82c3a9c 100644
--- a/BPASmartClient.SCADAControl/CustomerControls/Silos.xaml.cs
+++ b/BPASmartClient.SCADAControl/CustomerControls/Silos.xaml.cs
@@ -15,6 +15,7 @@ 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;
@@ -319,14 +320,14 @@ namespace BPASmartClient.SCADAControl.CustomerControls
#region 数据绑定模块
public event EventHandler PropertyChange; //声明一个事件
- [Category("数据绑定-数据来源")]
- public DataTypeEnum DataSouceType
- {
- get { return (DataTypeEnum)GetValue(DataSouceTypeProperty); }
- set { SetValue(DataSouceTypeProperty,value); }
- }
- public static readonly DependencyProperty DataSouceTypeProperty =
- DependencyProperty.Register("DataSouceType",typeof(DataTypeEnum),typeof(Silos),new PropertyMetadata(DataTypeEnum.静态数据));
+ //[Category("数据绑定-数据来源")]
+ //public DataTypeEnum DataSouceType
+ //{
+ // get { return (DataTypeEnum)GetValue(DataSouceTypeProperty); }
+ // set { SetValue(DataSouceTypeProperty,value); }
+ //}
+ //public static readonly DependencyProperty DataSouceTypeProperty =
+ // DependencyProperty.Register("DataSouceType",typeof(DataTypeEnum),typeof(Silos),new PropertyMetadata(DataTypeEnum.静态数据));
[Category("数据绑定-数据来源")]
public int TimeCount
{
@@ -335,30 +336,30 @@ namespace BPASmartClient.SCADAControl.CustomerControls
}
public static readonly DependencyProperty TimeCountProperty =
DependencyProperty.Register("TimeCount",typeof(int),typeof(Silos),new PropertyMetadata(5));
- [Category("数据绑定-数据来源")]
- public string DataSouceInformation
- {
- get { return (string)GetValue(DataSouceInformationProperty); }
- set { SetValue(DataSouceInformationProperty,value); }
- }
- public static readonly DependencyProperty DataSouceInformationProperty =
- DependencyProperty.Register("DataSouceInformation",typeof(string),typeof(Silos),new PropertyMetadata(string.Empty));
- [Category("数据绑定-数据来源")]
- public string DeviceName
- {
- get { return (string)GetValue(DeviceNameProperty); }
- set { SetValue(DeviceNameProperty,value); }
- }
- public static readonly DependencyProperty DeviceNameProperty =
- DependencyProperty.Register("DeviceName",typeof(string),typeof(Silos),new PropertyMetadata(string.Empty));
- [Category("数据绑定-数据来源")]
- public string DeviceValuleName
- {
- get { return (string)GetValue(DeviceValuleNameProperty); }
- set { SetValue(DeviceValuleNameProperty,value); }
- }
- public static readonly DependencyProperty DeviceValuleNameProperty =
- DependencyProperty.Register("DeviceValuleName",typeof(string),typeof(Silos),new PropertyMetadata(string.Empty));
+ //[Category("数据绑定-数据来源")]
+ //public string DataSouceInformation
+ //{
+ // get { return (string)GetValue(DataSouceInformationProperty); }
+ // set { SetValue(DataSouceInformationProperty,value); }
+ //}
+ //public static readonly DependencyProperty DataSouceInformationProperty =
+ // DependencyProperty.Register("DataSouceInformation",typeof(string),typeof(Silos),new PropertyMetadata(string.Empty));
+ //[Category("数据绑定-数据来源")]
+ //public string DeviceName
+ //{
+ // get { return (string)GetValue(DeviceNameProperty); }
+ // set { SetValue(DeviceNameProperty,value); }
+ //}
+ //public static readonly DependencyProperty DeviceNameProperty =
+ // DependencyProperty.Register("DeviceName",typeof(string),typeof(Silos),new PropertyMetadata(string.Empty));
+ //[Category("数据绑定-数据来源")]
+ //public string DeviceValuleName
+ //{
+ // get { return (string)GetValue(DeviceValuleNameProperty); }
+ // set { SetValue(DeviceValuleNameProperty,value); }
+ //}
+ //public static readonly DependencyProperty DeviceValuleNameProperty =
+ // DependencyProperty.Register("DeviceValuleName",typeof(string),typeof(Silos),new PropertyMetadata(string.Empty));
[Category("数据绑定")]
public string FDataSouce
@@ -404,11 +405,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls
}
public static readonly DependencyProperty GenerateDataProperty =
DependencyProperty.Register("GenerateData",typeof(string),typeof(Silos),new PropertyMetadata(string.Empty));
- public void RefreshData()
- {
- ;
- }
-
#endregion
#region 发送事件名称集合
@@ -510,6 +506,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls
#region 运行事件
DispatcherTimer timer = new DispatcherTimer();
+ Dictionary propertyBing = new Dictionary();
List MessageNameL = null;
public void Register()
{
@@ -545,7 +542,17 @@ namespace BPASmartClient.SCADAControl.CustomerControls
MessageNameL = MessageNameNew;
}
- timer.Interval = TimeSpan.FromMilliseconds(50);
+ PropertyInfo[] propertyInfos = this.GetType().GetProperties();
+ foreach (PropertyInfo propertyInfo in propertyInfos)
+ {
+ var propName = propertyInfo?.GetValue(this,null);
+ if (propName is string && propName != null && propName.ToString().Contains("Binding ") && propName.ToString().Contains("."))
+ {
+ propertyBing[propertyInfo.Name] = propName.ToString();
+ }
+ }
+
+ timer.Interval = TimeSpan.FromMilliseconds(TimeCount);
timer.Tick += Timer_Tick; ;
timer.Start();
@@ -555,11 +562,21 @@ namespace BPASmartClient.SCADAControl.CustomerControls
{
try
{
- if (!string.IsNullOrEmpty(DeviceName) && !string.IsNullOrEmpty(DeviceValuleName))
+ foreach (var item in propertyBing)
{
- if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(DeviceValuleName))
+ //{Binding 测试设备.VAR_A_2}
+ string[] str= item.Value.Replace("{Binding ","").Replace("}","").Split(".");
+ if (str.Length > 1)
{
- textBlockTitle.Text= Class_DataBus.GetInstance().Dic_DeviceData[DeviceValuleName].ToString();
+ if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0]))
+ {
+ Dictionary b= Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
+ if (b!=null && b.ContainsKey(str[1]))
+ {
+ object _value = b[str[1]];
+ this.GetType().GetProperty(item.Key).SetValue(this,_value);
+ }
+ }
}
}
}
diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheBlueProgressBar.cs b/BPASmartClient.SCADAControl/CustomerControls/TheBlueProgressBar.cs
new file mode 100644
index 00000000..515afa53
--- /dev/null
+++ b/BPASmartClient.SCADAControl/CustomerControls/TheBlueProgressBar.cs
@@ -0,0 +1,63 @@
+using BPASmartClient.Compiler;
+using BPASmartClient.SCADAControl;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+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.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+namespace BPASmartClient.SCADAControl.CustomerControls
+{
+ public class TheBlueProgressBar :ProgressBar, IExecutable, IDisposable
+ {
+ public event EventHandler PropertyChange; //声明一个事件
+
+ public TheBlueProgressBar()
+ {
+ ResourceDictionary languageResDic = new ResourceDictionary();
+ languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
+ this.Resources.MergedDictionaries.Add(languageResDic);
+ SetCurrentValue(WidthProperty,100d);
+ SetCurrentValue(HeightProperty,100d);
+ SetCurrentValue(ValueProperty,50d);
+ }
+ static TheBlueProgressBar()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(TheBlueProgressBar),new FrameworkPropertyMetadata(typeof(TheBlueProgressBar)));
+ }
+
+ public string ControlType => "控件";
+
+ private bool isExecuteState;
+ public bool IsExecuteState
+ {
+ get { return isExecuteState; }
+ set
+ {
+ isExecuteState = value;
+ if (IsExecuteState)
+ {
+ Register();
+ Style = null;
+ }
+ }
+ }
+
+ public void Register()
+ {
+
+ }
+
+ public void Dispose()
+ {
+ }
+ }
+}
diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheButton.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/TheButton.xaml.cs
index a7d24e1d..66b56948 100644
--- a/BPASmartClient.SCADAControl/CustomerControls/TheButton.xaml.cs
+++ b/BPASmartClient.SCADAControl/CustomerControls/TheButton.xaml.cs
@@ -1,8 +1,10 @@
using BPASmartClient.Compiler;
+using BPASmartClient.DATABUS;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -14,6 +16,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using System.Windows.Threading;
namespace BPASmartClient.SCADAControl.CustomerControls
{
@@ -23,15 +26,15 @@ namespace BPASmartClient.SCADAControl.CustomerControls
///
public partial class TheButton : Button, IExecutable
{
- public event EventHandler PropertyChange; //声明一个事件
-
public TheButton()
{
InitializeComponent();
+ ResourceDictionary languageResDic = new ResourceDictionary();
+ languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
+ this.Resources.MergedDictionaries.Add(languageResDic);
Content = "按钮";
Width = 80;
Height = 30;
- Style = Application.Current.Resources["DesignButton"] as Style;//FindResource("DesignButton") as Style;
}
public string ControlType => "控件";
@@ -60,17 +63,82 @@ namespace BPASmartClient.SCADAControl.CustomerControls
public static readonly DependencyProperty ClickExecProperty =
DependencyProperty.Register("ClickExec", typeof(string), typeof(TheButton), new PropertyMetadata(string.Empty));
+
+ private void MyButton_Click(object sender, RoutedEventArgs e)
+ {
+ Config.GetInstance().RunJsScipt(ClickExec);
+ }
+
+ #region 数据绑定模块
+ [Category("数据绑定-数据来源")]
+ public int TimeCount
+ {
+ get { return (int)GetValue(TimeCountProperty); }
+ set { SetValue(TimeCountProperty,value); }
+ }
+ public static readonly DependencyProperty TimeCountProperty =
+ DependencyProperty.Register("TimeCount",typeof(int),typeof(TheButton),new PropertyMetadata(5));
+ public event EventHandler PropertyChange; //声明一个事件
+ ///
+ /// 属性刷新器
+ ///
+ DispatcherTimer timer = new DispatcherTimer();
+ ///
+ /// 属性绑定变量集合
+ ///
+ Dictionary propertyBing = new Dictionary();
///
- /// 注册需要处理的事件
+ /// 运行事件
///
public void Register()
{
this.Click += MyButton_Click;
- }
+ PropertyInfo[] propertyInfos = this.GetType().GetProperties();
+ foreach (PropertyInfo propertyInfo in propertyInfos)
+ {
+ var propName = propertyInfo?.GetValue(this,null);
+ if (propName is string && propName != null && propName.ToString().Contains("Binding ") && propName.ToString().Contains("."))
+ {
+ propertyBing[propertyInfo.Name] = propName.ToString();
+ }
+ }
- private void MyButton_Click(object sender, RoutedEventArgs e)
+ timer.Interval = TimeSpan.FromMilliseconds(TimeCount);
+ timer.Tick += Timer_Tick; ;
+ timer.Start();
+ }
+ ///
+ /// 属性刷新事件
+ ///
+ ///
+ ///
+ private void Timer_Tick(object? sender,EventArgs e)
{
- Config.GetInstance().RunJsScipt(ClickExec);
+ try
+ {
+ foreach (var item in propertyBing)
+ {
+ //{Binding 测试设备.VAR_A_2}
+ string[] str = item.Value.Replace("{Binding ","").Replace("}","").Split(".");
+ if (str.Length > 1)
+ {
+ if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0]))
+ {
+ Dictionary b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
+ if (b != null && b.ContainsKey(str[1]))
+ {
+ object _value = b[str[1]];
+ this.GetType().GetProperty(item.Key).SetValue(this,_value);
+ }
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+
+ }
}
+ #endregion
}
}
diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheCheckBox.xaml b/BPASmartClient.SCADAControl/CustomerControls/TheCheckBox.xaml
index abbb7c4a..ebfb966d 100644
--- a/BPASmartClient.SCADAControl/CustomerControls/TheCheckBox.xaml
+++ b/BPASmartClient.SCADAControl/CustomerControls/TheCheckBox.xaml
@@ -6,4 +6,11 @@
xmlns:local="clr-namespace:BPASmartClient.SCADAControl.CustomerControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
+
+
+
+
+
+
+
diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheComboBox.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/TheComboBox.xaml.cs
index 47a1c06b..2eed2a35 100644
--- a/BPASmartClient.SCADAControl/CustomerControls/TheComboBox.xaml.cs
+++ b/BPASmartClient.SCADAControl/CustomerControls/TheComboBox.xaml.cs
@@ -28,9 +28,12 @@ namespace BPASmartClient.SCADAControl.CustomerControls
public TheComboBox()
{
InitializeComponent();
- VerticalContentAlignment = VerticalAlignment.Center;
+ ResourceDictionary languageResDic = new ResourceDictionary();
+ languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
+ this.Resources.MergedDictionaries.Add(languageResDic);
+ //VerticalContentAlignment = VerticalAlignment.Center;
ItemsString = new ItemsList() { "AA", "BB" };
- Style = Application.Current.Resources["DesignComboBox"] as Style;
+ //Style = Application.Current.Resources["DesignComboBox"] as Style;
Width = 80;
Height = 30;
Focusable = false;
diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheGreenProgressBar.cs b/BPASmartClient.SCADAControl/CustomerControls/TheGreenProgressBar.cs
new file mode 100644
index 00000000..8cff9a97
--- /dev/null
+++ b/BPASmartClient.SCADAControl/CustomerControls/TheGreenProgressBar.cs
@@ -0,0 +1,64 @@
+using BPASmartClient.Compiler;
+using BPASmartClient.SCADAControl;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+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.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace BPASmartClient.SCADAControl.CustomerControls
+{
+ public class TheGreenProgressBar :ProgressBar, IExecutable, IDisposable
+ {
+ public event EventHandler PropertyChange; //声明一个事件
+
+ public TheGreenProgressBar()
+ {
+ ResourceDictionary languageResDic = new ResourceDictionary();
+ languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
+ this.Resources.MergedDictionaries.Add(languageResDic);
+ SetCurrentValue(WidthProperty,100d);
+ SetCurrentValue(HeightProperty,100d);
+ SetCurrentValue(ValueProperty,50d);
+ }
+ static TheGreenProgressBar()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(TheGreenProgressBar),new FrameworkPropertyMetadata(typeof(TheGreenProgressBar)));
+ }
+
+ public string ControlType => "控件";
+
+ private bool isExecuteState;
+ public bool IsExecuteState
+ {
+ get { return isExecuteState; }
+ set
+ {
+ isExecuteState = value;
+ if (IsExecuteState)
+ {
+ Register();
+ Style = null;
+ }
+ }
+ }
+
+ public void Register()
+ {
+
+ }
+
+ public void Dispose()
+ {
+ }
+ }
+}
diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheGroupBox.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/TheGroupBox.xaml.cs
index 2d767d1d..e97315b4 100644
--- a/BPASmartClient.SCADAControl/CustomerControls/TheGroupBox.xaml.cs
+++ b/BPASmartClient.SCADAControl/CustomerControls/TheGroupBox.xaml.cs
@@ -27,6 +27,9 @@ namespace BPASmartClient.SCADAControl.CustomerControls
public TheGroupBox()
{
InitializeComponent();
+ ResourceDictionary languageResDic = new ResourceDictionary();
+ languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
+ this.Resources.MergedDictionaries.Add(languageResDic);
Width = 150;
Height = 150;
Header = "分组";
diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/TheProgressBar.cs
similarity index 56%
rename from BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.xaml.cs
rename to BPASmartClient.SCADAControl/CustomerControls/TheProgressBar.cs
index d25881e1..03c47edf 100644
--- a/BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.xaml.cs
+++ b/BPASmartClient.SCADAControl/CustomerControls/TheProgressBar.cs
@@ -18,16 +18,24 @@ using System.Windows.Shapes;
namespace BPASmartClient.SCADAControl.CustomerControls
{
///
- /// TheTextBlock.xaml 的交互逻辑
+ /// 正常进度条
///
- public partial class TheTextBlock : TextBlock, IExecutable
+ public class TheProgressBar:ProgressBar, IExecutable, IDisposable
{
public event EventHandler PropertyChange; //声明一个事件
- public TheTextBlock()
+ public TheProgressBar()
{
- InitializeComponent();
- Text = "文本块";
+ ResourceDictionary languageResDic = new ResourceDictionary();
+ languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
+ this.Resources.MergedDictionaries.Add(languageResDic);
+ SetCurrentValue(WidthProperty,200d);
+ SetCurrentValue(HeightProperty,16d);
+ SetCurrentValue(ValueProperty,50d);
+ }
+ static TheProgressBar()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(TheProgressBar),new FrameworkPropertyMetadata(typeof(TheProgressBar)));
}
public string ControlType => "控件";
@@ -42,12 +50,18 @@ namespace BPASmartClient.SCADAControl.CustomerControls
if (IsExecuteState)
{
Register();
+ Style = null;
}
}
}
public void Register()
{
+
+ }
+
+ public void Dispose()
+ {
}
}
}
diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheRadioButton.cs b/BPASmartClient.SCADAControl/CustomerControls/TheRadioButton.cs
index 51397261..c56d26ed 100644
--- a/BPASmartClient.SCADAControl/CustomerControls/TheRadioButton.cs
+++ b/BPASmartClient.SCADAControl/CustomerControls/TheRadioButton.cs
@@ -23,6 +23,9 @@ namespace BPASmartClient.SCADAControl.CustomerControls
public TheRadioButton()
{
+ ResourceDictionary languageResDic = new ResourceDictionary();
+ languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
+ this.Resources.MergedDictionaries.Add(languageResDic);
SetCurrentValue(ContentProperty, "单选按钮");
}
static TheRadioButton()
diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheRedProgressBar.cs b/BPASmartClient.SCADAControl/CustomerControls/TheRedProgressBar.cs
new file mode 100644
index 00000000..fc62e200
--- /dev/null
+++ b/BPASmartClient.SCADAControl/CustomerControls/TheRedProgressBar.cs
@@ -0,0 +1,64 @@
+using BPASmartClient.Compiler;
+using BPASmartClient.SCADAControl;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+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.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace BPASmartClient.SCADAControl.CustomerControls
+{
+ public class TheRedProgressBar :ProgressBar, IExecutable, IDisposable
+ {
+ public event EventHandler PropertyChange; //声明一个事件
+
+ public TheRedProgressBar()
+ {
+ ResourceDictionary languageResDic = new ResourceDictionary();
+ languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
+ this.Resources.MergedDictionaries.Add(languageResDic);
+ SetCurrentValue(WidthProperty,100d);
+ SetCurrentValue(HeightProperty,100d);
+ SetCurrentValue(ValueProperty,50d);
+ }
+ static TheRedProgressBar()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(TheRedProgressBar),new FrameworkPropertyMetadata(typeof(TheRedProgressBar)));
+ }
+
+ public string ControlType => "控件";
+
+ private bool isExecuteState;
+ public bool IsExecuteState
+ {
+ get { return isExecuteState; }
+ set
+ {
+ isExecuteState = value;
+ if (IsExecuteState)
+ {
+ Register();
+ Style = null;
+ }
+ }
+ }
+
+ public void Register()
+ {
+
+ }
+
+ public void Dispose()
+ {
+ }
+ }
+}
diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheRedis.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/TheRedis.xaml.cs
index 2d11a039..b6f76ea3 100644
--- a/BPASmartClient.SCADAControl/CustomerControls/TheRedis.xaml.cs
+++ b/BPASmartClient.SCADAControl/CustomerControls/TheRedis.xaml.cs
@@ -131,7 +131,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls
Direction = 2;
}
}
- timer.Interval = TimeSpan.FromSeconds(Interval);
+ timer.Interval = TimeSpan.FromSeconds(TimeCount);
timer.Tick += Timer_Tick;
timer.Start();
@@ -159,13 +159,18 @@ namespace BPASmartClient.SCADAControl.CustomerControls
}
if (Direction == 1) //定时读取数据
{
- RedisValue obj = fRedisClient.RedisGet(DeviceName);
- FDataSouce = obj.ToString();
- List str = JsonConvert.DeserializeObject>(FDataSouce);
- str?.ForEach(par =>
+ if (!string.IsNullOrEmpty(DeviceName))
{
- Class_DataBus.GetInstance().Dic_DeviceData[par.VarName] = par.VarVaule;
- });
+ RedisValue obj = fRedisClient.RedisGet(DeviceName);
+ FDataSouce = obj.ToString();
+ List str = JsonConvert.DeserializeObject>(FDataSouce);
+ Dictionary keys=new Dictionary();
+ str?.ForEach(par =>
+ {
+ keys[par.VarName] = par.VarVaule;
+ });
+ Class_DataBus.GetInstance().Dic_DeviceData[DeviceName] = keys;
+ }
}
}
@@ -178,17 +183,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls
}
#region 属性
- ///
- /// 时间间隔
- ///
- [Category("值设定")]
- public int Interval
- {
- get { return (int)GetValue(IntervalProperty); }
- set { SetValue(IntervalProperty,value); }
- }
- public static readonly DependencyProperty IntervalProperty =
- DependencyProperty.Register("Interval",typeof(int),typeof(TheRedis),new PropertyMetadata(1));
[Category("值设定")]
public int Direction
{
@@ -251,14 +245,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls
#region 数据绑定模块
public event EventHandler PropertyChange; //声明一个事件
[Category("数据绑定-数据来源")]
- public DataTypeEnum DataSouceType
- {
- get { return (DataTypeEnum)GetValue(DataSouceTypeProperty); }
- set { SetValue(DataSouceTypeProperty,value); }
- }
- public static readonly DependencyProperty DataSouceTypeProperty =
- DependencyProperty.Register("DataSouceType",typeof(DataTypeEnum),typeof(TheRedis),new PropertyMetadata(DataTypeEnum.静态数据));
- [Category("数据绑定-数据来源")]
public int TimeCount
{
get { return (int)GetValue(TimeCountProperty); }
@@ -282,15 +268,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls
}
public static readonly DependencyProperty DeviceNameProperty =
DependencyProperty.Register("DeviceName",typeof(string),typeof(TheRedis),new PropertyMetadata(string.Empty));
- [Category("数据绑定-数据来源")]
- public string DeviceValuleName
- {
- get { return (string)GetValue(DeviceValuleNameProperty); }
- set { SetValue(DeviceValuleNameProperty,value); }
- }
- public static readonly DependencyProperty DeviceValuleNameProperty =
- DependencyProperty.Register("DeviceValuleName",typeof(string),typeof(TheRedis),new PropertyMetadata(string.Empty));
-
[Category("数据绑定")]
public string FDataSouce
{
@@ -335,10 +312,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls
}
public static readonly DependencyProperty GenerateDataProperty =
DependencyProperty.Register("GenerateData",typeof(string),typeof(TheRedis),new PropertyMetadata(string.Empty));
- public void RefreshData()
- {
- ;
- }
#endregion
diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.cs b/BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.cs
new file mode 100644
index 00000000..63402366
--- /dev/null
+++ b/BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.cs
@@ -0,0 +1,128 @@
+using BPASmartClient.Compiler;
+using BPASmartClient.DATABUS;
+using BPASmartClient.SCADAControl;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+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.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using System.Windows.Threading;
+
+
+namespace BPASmartClient.SCADAControl.CustomerControls
+{
+ public class TheTextBlock :TextBlock, IExecutable
+ {
+ static TheTextBlock()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(TheTextBlock),new FrameworkPropertyMetadata(typeof(TheTextBlock)));
+ }
+ public TheTextBlock()
+ {
+ ResourceDictionary languageResDic = new ResourceDictionary();
+ languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
+ this.Resources.MergedDictionaries.Add(languageResDic);
+ }
+
+ public string ControlType => "控件";
+
+ private bool isExecuteState;
+ public bool IsExecuteState
+ {
+ get { return isExecuteState; }
+ set
+ {
+ isExecuteState = value;
+ if (IsExecuteState)
+ {
+ Register();
+ }
+ }
+ }
+
+ #region 数据绑定模块
+ [Category("数据绑定-数据来源")]
+ public int TimeCount
+ {
+ get { return (int)GetValue(TimeCountProperty); }
+ set { SetValue(TimeCountProperty,value); }
+ }
+ public static readonly DependencyProperty TimeCountProperty =
+ DependencyProperty.Register("TimeCount",typeof(int),typeof(TheTextBlock),new PropertyMetadata(5));
+ public event EventHandler PropertyChange; //声明一个事件
+ ///
+ /// 属性刷新器
+ ///
+ DispatcherTimer timer = new DispatcherTimer();
+ ///
+ /// 属性绑定变量集合
+ ///
+ Dictionary propertyBing = new Dictionary();
+ ///
+ /// 运行事件
+ ///
+ public void Register()
+ {
+ PropertyInfo[] propertyInfos = this.GetType().GetProperties();
+ foreach (PropertyInfo propertyInfo in propertyInfos)
+ {
+ var propName = propertyInfo?.GetValue(this,null);
+ if (propName is string && propName != null && propName.ToString().Contains("Binding ") && propName.ToString().Contains("."))
+ {
+ string va = string.Empty;
+ if (propName.ToString().StartsWith("{}")) va = propName.ToString().Replace("{}","");
+ else va = propName.ToString();
+ propertyBing[propertyInfo.Name] = va;
+ }
+ }
+
+ timer.Interval = TimeSpan.FromMilliseconds(TimeCount);
+ timer.Tick += Timer_Tick; ;
+ timer.Start();
+ }
+ ///
+ /// 属性刷新事件
+ ///
+ ///
+ ///
+ private void Timer_Tick(object? sender,EventArgs e)
+ {
+ try
+ {
+ foreach (var item in propertyBing)
+ {
+ //{Binding 测试设备.VAR_A_2}
+ string[] str = item.Value.Replace("{Binding ","").Replace("}","").Split(".");
+ if (str.Length > 1)
+ {
+ if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0]))
+ {
+ Dictionary b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
+ if (b != null && b.ContainsKey(str[1]))
+ {
+ object _value = b[str[1]];
+ this.GetType().GetProperty(item.Key).SetValue(this,_value);
+ }
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+ #endregion
+ }
+}
diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.xaml b/BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.xaml
deleted file mode 100644
index ec4529e2..00000000
--- a/BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.xaml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheTextBox.cs b/BPASmartClient.SCADAControl/CustomerControls/TheTextBox.cs
index 33230d51..1740e9fa 100644
--- a/BPASmartClient.SCADAControl/CustomerControls/TheTextBox.cs
+++ b/BPASmartClient.SCADAControl/CustomerControls/TheTextBox.cs
@@ -1,8 +1,11 @@
using BPASmartClient.Compiler;
+using BPASmartClient.DATABUS;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -14,12 +17,13 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using System.Windows.Threading;
namespace BPASmartClient.SCADAControl.CustomerControls
{
public class TheTextBox : TextBox, IExecutable
{
- public event EventHandler PropertyChange; //声明一个事件
+
static TheTextBox()
{
@@ -28,10 +32,20 @@ namespace BPASmartClient.SCADAControl.CustomerControls
public TheTextBox()
{
+ ResourceDictionary languageResDic = new ResourceDictionary();
+ languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
+ this.Resources.MergedDictionaries.Add(languageResDic);
Text = "0.01";
- VerticalContentAlignment = VerticalAlignment.Center;
- Style = Application.Current.Resources["DesignTheTextBox"] as Style;//FindResource("DesignTheTextBox") as Style;
- Focusable = false;
+ //VerticalContentAlignment = VerticalAlignment.Center;
+ //Style = Application.Current.Resources["DesignTheTextBox"] as Style;//FindResource("DesignTheTextBox") as Style;
+ //Focusable = false;
+ Height = 30;
+ Width = 80;
+ FontSize = 16;
+ //HorizontalAlignment = HorizontalAlignment.Left;
+ //VerticalAlignment = VerticalAlignment.Center;
+ //Foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#a2c2e8"));
+ //BorderThickness=new Thickness(1);
}
public string ControlType => "控件";
@@ -52,8 +66,78 @@ namespace BPASmartClient.SCADAControl.CustomerControls
}
}
+
+
+ #region 数据绑定模块
+ [Category("数据绑定-数据来源")]
+ public int TimeCount
+ {
+ get { return (int)GetValue(TimeCountProperty); }
+ set { SetValue(TimeCountProperty,value); }
+ }
+ public static readonly DependencyProperty TimeCountProperty =
+ DependencyProperty.Register("TimeCount",typeof(int),typeof(TheTextBox),new PropertyMetadata(5));
+ public event EventHandler PropertyChange; //声明一个事件
+ ///
+ /// 属性刷新器
+ ///
+ DispatcherTimer timer = new DispatcherTimer();
+ ///
+ /// 属性绑定变量集合
+ ///
+ Dictionary propertyBing = new Dictionary();
+ ///
+ /// 运行事件
+ ///
public void Register()
{
+ PropertyInfo[] propertyInfos = this.GetType().GetProperties();
+ foreach (PropertyInfo propertyInfo in propertyInfos)
+ {
+ var propName = propertyInfo?.GetValue(this,null);
+ if (propName is string && propName != null && propName.ToString().Contains("Binding ") && propName.ToString().Contains("."))
+ {
+ propertyBing[propertyInfo.Name] = propName.ToString();
+ }
+ }
+
+ timer.Interval = TimeSpan.FromMilliseconds(TimeCount);
+ timer.Tick += Timer_Tick; ;
+ timer.Start();
}
+ ///
+ /// 属性刷新事件
+ ///
+ ///
+ ///
+ private void Timer_Tick(object? sender,EventArgs e)
+ {
+ try
+ {
+ foreach (var item in propertyBing)
+ {
+ //{Binding 测试设备.VAR_A_2}
+ string[] str = item.Value.Replace("{Binding ","").Replace("}","").Split(".");
+ if (str.Length > 1)
+ {
+ if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0]))
+ {
+ Dictionary b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
+ if (b != null && b.ContainsKey(str[1]))
+ {
+ object _value = b[str[1]];
+ this.GetType().GetProperty(item.Key).SetValue(this,_value);
+ }
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+ #endregion
+
}
}
diff --git a/BPASmartClient.SCADAControl/CustomerControls/WaveProgressBar.cs b/BPASmartClient.SCADAControl/CustomerControls/WaveProgressBar.cs
index 21f78609..b66cdd5b 100644
--- a/BPASmartClient.SCADAControl/CustomerControls/WaveProgressBar.cs
+++ b/BPASmartClient.SCADAControl/CustomerControls/WaveProgressBar.cs
@@ -30,6 +30,9 @@ namespace BPASmartClient.SCADAControl.CustomerControls
public WaveProgressBar()
{
+ ResourceDictionary languageResDic = new ResourceDictionary();
+ languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
+ this.Resources.MergedDictionaries.Add(languageResDic);
Loaded += (s, e) => UpdateWave(Value);
SetCurrentValue(WidthProperty, 200d);
SetCurrentValue(HeightProperty, 200d);
diff --git a/BPASmartClient.SCADAControl/Images/2609.png b/BPASmartClient.SCADAControl/Images/2609.png
new file mode 100644
index 0000000000000000000000000000000000000000..f3ad8684e417e39e429ab40651bedfb510c08f3b
GIT binary patch
literal 313
zcmV-90mlA`P)TCnsB
z8@LH%-*BG5*uiQ5qg-qf#|exj91O!Kl8dQc;3^3B7+kD3^SBMdoi;5tVD_5eis~FS
z#!3?7?yoV5zUNV5JS8#ak{J6*jFUP>Q45VL##s_$w~kSV(1&pyEbU>e2eSVbV-SQ2
zqn*U)jx$Dik7x>(3m#!QSX=@g;v`b3N<00000
LNkvXXu0mjfzopr
E0H5d|dH?_b
literal 0
HcmV?d00001
diff --git a/BPASmartClient.SCADAControl/Images/btn_normal.png b/BPASmartClient.SCADAControl/Images/btn_normal.png
new file mode 100644
index 0000000000000000000000000000000000000000..39b5d8202eb2c970dd278ab05ba35f882a094ba5
GIT binary patch
literal 317
zcmV-D0mA-?P)
znJreT4Lq-pa(&=(ISRgfTLPuQ#{W-)(ZkDR09fKvG!=qTWhEKTxYky*?`vh*9c
z6+;iLhk5X?w0;v-3~iIdvm$=Sv{Yg8pGBUH7~Y+V-zdWE#9%6h2+!*kHrO(e7@kpX
z&5kZFU24ib5O)9K;?;)*{py)bR&EWru#5Y58V|q?aJmcs1Z3oo_B4PWK3-)I3HM?m
P00000NkvXXu0mjfFaC%6
literal 0
HcmV?d00001
diff --git a/BPASmartClient.SCADAControl/Images/button1.png b/BPASmartClient.SCADAControl/Images/button1.png
new file mode 100644
index 0000000000000000000000000000000000000000..090324dd3cc4cc8ec9b33018572373b2120c3960
GIT binary patch
literal 274
zcmeAS@N?(olHy`uVBq!ia0vp^1wgFD!3HF=zuvzEq;7h;IEGZrd3(o^*U3=C<)S&S
zoCA|lM8eb6jO-kWjl4k-j}|TYtCd%Eo{4ep9{cr~PJP?2?`8G>fro%~I>e5M^uog&8Z;YGRbF)dkM_YsADPorp>L@JuMVA!H--%Qp@t
z)&l4GTsAX*gfJN%J`;L8TkqPb
z86MW~yL`44IKN%RW_y6a_JBQ=6XX91+?eCAY2M%Zq;u!rZ~GOg5c-NgBT8zw;r)m`
QKuIr;odwdFF;|#KU}KFrILlC&ifg;~NJP;|b@$OdW+e
zza31zH&(ox^kI(E!8uMJ_c(q0BjjvW^iTcS#+r0{u4P_-84p`aY`K+?+6wd=gQu&X
J%Q~loCIAska7O?D
literal 0
HcmV?d00001
diff --git a/BPASmartClient.SCADAControl/Images/nbbj.png b/BPASmartClient.SCADAControl/Images/nbbj.png
new file mode 100644
index 0000000000000000000000000000000000000000..1eb5d35aaf5198bd3c237dea6065068a8015e376
GIT binary patch
literal 3653
zcmeHK`&W{Q7X8dhvxm8+a!ieBF*kEctmvB32iQz$4kf0gg(*{1_yQ`_K@jwsx3W;W
zqnVoe>2iE!XyyBbIZiqgCO+_i@A83)hz1Bk&~4rS;;z*XXRUqqk9(c7*WO7!-kw`6
zc3S`du+{7INnZdkfxb+g`Nl6y7H(lT0Bqahb@Ie{Mz(zHEOn-?x&4ao$7RG`;al*)
zUt#O6aio`mH=_3^S%3czd;2G{g4BnhNu7>Nf_mV&fIdOKHe%4*8of_FT8JhA!
zd@c($@w~d9;&^?Y=8QZkj9q(7Y%it+N?Isr7s`6_gis)t3#MJhiHT;DJvZWq-Da|J
zG+~3d<{*Cw4o0nA#03pP#H(ozgO=sPWcZR
zQQdEq+1!zb2uRdLclHv3nDLw!J2Y+D%kSs?@I>lJt&2k*{cj5Fz)i(Bk3It61>U>E
zD^<~d7DuphaFpt_n$-{D!%dxiK-8KRg(M1U*%l%Jh0oRxI6yWz@*&gRsiOMzzj9sy
zCZIR;OHKH4CJPk0hIGGeNUL#%qtpde*X_La!`(?9x~rR(8nvpDMQN3CS1vzDNHI(i
z&te)(moK70`H(C$ilzobx^;U*Lurm^5RHPnSEn~que;&f#$s(CPF>z2y;N=?y5F<9
zEB_11<~+~>puhg8x~e&4PE4aLuA~V*(-Vu6G5t(C|1vC3bj#p?
zNZxj+*+DkkPFLJ3pO~tYR~)zIqH|)dgdQ(~4sT*_6V*>g?*W0yTf;Va@PqWtA*C#d
zM?8U2sPg8Pk|S1CRBm%F{ZYNORK2jJBTAa!w$>Cp`#wQlCv0^B$+6MLtT!;8y-XkY
zrmAVoCvts>`dhW>Mqx-73mbe4qLQd6jOKyJ+_n6a8QGb+P5nSQL4
z_A8%rYHsz^Dqc~!xN-Tk+7)rAq9T+&QjB*erAiqS)?@oS_9J;eG&MOjJ|47HUWtpE
z%L++x5bVnt^c^u+3r&{o33Wgxd;U`qNa^Nz?~`)nsMa(a1%xnvF1iG6F+ROc#UW8O&Zigon#83vO=jtmnG
z^%6!jMy5@_&EBv=M7R_Gaqnso8nC?Zgn->ZUd`iD#j+_+t`5t>Q`v6KPK|2k+q=RK
z=G*stNlv6F3KZv_nN;sTLyEw1d9mm+
zA%Xg5tvPX_EcCwY@vLBIW@p}>?BN@UTnxaAgu=R(x!)!a4%%en<#qNRWkhex6kO)J
z;NtmvLwR8Y%b8$XAV$6NBa~ft43`L3Eqq`}!<{LAn@z@yuXYoWYld7KM#sZ09fj`fm2n#QrAUMhhvsBRlGk$nTGhf+zq@a(0)BvE^
z)xw9!0-LRn?(m~-&NSqsL|TldQdLu91}?O6mK-nw$z4n*3t(X;-jnS
zewD^C&+kks-j!W*&5BFx!oIUf;*8yHo)-Z0upRbEQAU9!Fu-
z?PfWm%QoSfQ^Q}p>tIgb=>@x=|$UBQ>kxjnhCCNL3$nKen&ht}Z*T)eY?
zINedcMHD;QQHVB}M~`R@t5xgz;b1|y#rkDX6F56s1PxxR6k}FY%bkuPf)>qm?FXcQ
zLA(-P82;$s=oSnhQgTweV;1D7h?{nZ42O}fBxwNxYmQ&L
z6x(j}Cf1f!FOfb-MqVveFR~=HFB>US)9BIFJoD|Z;p_&lkmiZaDv)tAXhJC??$ijiX}23QLUR1P
z6=y7an(|v;BByn}@zO@>LDV|r9eR*nskhPcwU@h)V^Z??HrpMw115|ry>p757Wc0?
w=%I+LHl%OzfB_uO|MfRx5pdtJ@DuDR^88#ttpB|)^$_qn<$bdJ$6pfu3wDuu)c^nh
literal 0
HcmV?d00001
diff --git a/BPASmartClient.SCADAControl/Themes/Generic.xaml b/BPASmartClient.SCADAControl/Themes/Generic.xaml
index 6076274f..4f65bdbb 100644
--- a/BPASmartClient.SCADAControl/Themes/Generic.xaml
+++ b/BPASmartClient.SCADAControl/Themes/Generic.xaml
@@ -1,8 +1,9 @@
-
@@ -137,19 +138,6 @@
-
-
-
-
-
+
-
-
-
+
+
+
+
-
-
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ M 0 0 L 3.5 4 L 7 0 Z
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+