|
|
@@ -31,6 +31,11 @@ namespace BPASmartClient.SCADAControl |
|
|
|
{ |
|
|
|
#region 临时变量 |
|
|
|
TextBlock textBlockCLKZ = null; |
|
|
|
TextBlock textBlockValue=null; |
|
|
|
TextBlock textBlockText = null; |
|
|
|
TextBlock textBlockTitle = null; |
|
|
|
|
|
|
|
|
|
|
|
Ellipse ellipseControl = null; |
|
|
|
Storyboard storyboard = new Storyboard(); |
|
|
|
#endregion |
|
|
@@ -44,8 +49,13 @@ namespace BPASmartClient.SCADAControl |
|
|
|
//Value = "25.23"; |
|
|
|
//Title = "香料"; |
|
|
|
//Text = "1"; |
|
|
|
this.SizeChanged += Silos_SizeChanged; ; |
|
|
|
|
|
|
|
//this.SizeChanged += Silos_SizeChanged; ; |
|
|
|
this.Loaded += Silos_Loaded; |
|
|
|
} |
|
|
|
|
|
|
|
private void Silos_Loaded(object sender, RoutedEventArgs e) |
|
|
|
{ |
|
|
|
Silos_SizeChanged(null, null); |
|
|
|
} |
|
|
|
|
|
|
|
public string ControlType => "物料仓"; |
|
|
@@ -96,6 +106,17 @@ namespace BPASmartClient.SCADAControl |
|
|
|
if (tb.Tag.ToString() == "出料控制") |
|
|
|
{ |
|
|
|
textBlockCLKZ = tb; |
|
|
|
}else if (tb.Tag.ToString() == "Value") |
|
|
|
{ |
|
|
|
textBlockValue = tb; |
|
|
|
} |
|
|
|
else if (tb.Tag.ToString() == "Text") |
|
|
|
{ |
|
|
|
textBlockText = tb; |
|
|
|
} |
|
|
|
else if (tb.Tag.ToString() == "Title") |
|
|
|
{ |
|
|
|
textBlockTitle = tb; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -154,7 +175,9 @@ namespace BPASmartClient.SCADAControl |
|
|
|
set { SetValue(ValueProperty, value); } |
|
|
|
} |
|
|
|
public static readonly DependencyProperty ValueProperty = |
|
|
|
DependencyProperty.Register("Value", typeof(string), typeof(Silos), new PropertyMetadata(string.Empty)); |
|
|
|
DependencyProperty.Register("Value", typeof(string), typeof(Silos), new PropertyMetadata(new PropertyChangedCallback(onTargetChanged))); |
|
|
|
private static void onTargetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as Silos)?.TargetRefresh(); |
|
|
|
|
|
|
|
[Category("值设定")] |
|
|
|
public string Text |
|
|
|
{ |
|
|
@@ -162,7 +185,7 @@ namespace BPASmartClient.SCADAControl |
|
|
|
set { SetValue(TextProperty, value); } |
|
|
|
} |
|
|
|
public static readonly DependencyProperty TextProperty = |
|
|
|
DependencyProperty.Register("Text", typeof(string), typeof(Silos), new PropertyMetadata(string.Empty)); |
|
|
|
DependencyProperty.Register("Text", typeof(string), typeof(Silos), new PropertyMetadata(new PropertyChangedCallback(onTargetChanged))); |
|
|
|
|
|
|
|
[Category("值设定")] |
|
|
|
public string Title |
|
|
@@ -171,7 +194,7 @@ namespace BPASmartClient.SCADAControl |
|
|
|
set { SetValue(TitleProperty, value); } |
|
|
|
} |
|
|
|
public static readonly DependencyProperty TitleProperty = |
|
|
|
DependencyProperty.Register("Title", typeof(string), typeof(Silos), new PropertyMetadata(string.Empty)); |
|
|
|
DependencyProperty.Register("Title", typeof(string), typeof(Silos), new PropertyMetadata(new PropertyChangedCallback(onTargetChanged))); |
|
|
|
|
|
|
|
[Category("消息名称")] |
|
|
|
public MessageNameEnum EventRunName |
|
|
@@ -207,6 +230,21 @@ namespace BPASmartClient.SCADAControl |
|
|
|
#endregion |
|
|
|
|
|
|
|
#region 函数 |
|
|
|
/// <summary> |
|
|
|
/// 目标属性刷新 |
|
|
|
/// </summary> |
|
|
|
public void TargetRefresh() |
|
|
|
{ |
|
|
|
if (textBlockValue != null && textBlockText != null && textBlockTitle != null) |
|
|
|
{ |
|
|
|
textBlockValue.Text = Value; |
|
|
|
textBlockText.Text = Text; |
|
|
|
textBlockTitle.Text = Title; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 值变化刷新 |
|
|
|
/// </summary> |
|
|
@@ -254,11 +292,8 @@ namespace BPASmartClient.SCADAControl |
|
|
|
#region 运行事件 |
|
|
|
public void Register() |
|
|
|
{ |
|
|
|
if (EventRunName != MessageNameEnum.Null) |
|
|
|
{ |
|
|
|
Class_InnerMessageBus.GetInstance().ListenMessage(this, EventRunName.ToString(), "EventRunNameHandler"); |
|
|
|
Class_InnerMessageBus.GetInstance().ListenMessage(this, EventDataName.ToString(), "EventDataNameHandler"); |
|
|
|
} |
|
|
|
if (EventRunName != MessageNameEnum.Null) Class_InnerMessageBus.GetInstance().ListenMessage(this, EventRunName.ToString(), "EventRunNameHandler"); |
|
|
|
if (EventDataName != MessageNameEnum.Null) Class_InnerMessageBus.GetInstance().ListenMessage(this, EventDataName.ToString(), "EventDataNameHandler"); |
|
|
|
} |
|
|
|
|
|
|
|
public void EventRunNameHandler(object sender, InnerMessageEventArgs e) |
|
|
|