[UI.Client]
TV阀用户控件添加复位用的依赖属性 [RT.EquipmentLibrari] SetTVReset时修改参数解析
This commit is contained in:
parent
a400d95bc5
commit
e7143ed465
|
@ -389,7 +389,7 @@ namespace Aitex.Core.RT.Device.Devices
|
|||
|
||||
OP.Subscribe($"{Module}.{Name}.SetTVReset", (function, args) =>
|
||||
{
|
||||
bool bOn = Convert.ToBoolean((string)args[0]);
|
||||
bool bOn = (bool)args[0];
|
||||
if (SetTVReset(bOn, out string reason))
|
||||
_resetTimer.Start(1000);
|
||||
|
||||
|
|
|
@ -50,6 +50,13 @@ namespace Aitex.Core.UI.DeviceControl
|
|||
"CommandCloseTV", typeof(ICommand), typeof(AITThrottleValve2),
|
||||
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
|
||||
// Using a DependencyProperty as the backing store for CommandReset. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty CommandResetProperty =
|
||||
DependencyProperty.Register("CommandReset", typeof(ICommand), typeof(AITThrottleValve2), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
|
||||
|
||||
public static readonly DependencyProperty DeviceDataProperty = DependencyProperty.Register(
|
||||
"DeviceData", typeof(AITThrottleValveData), typeof(AITThrottleValve2),
|
||||
new FrameworkPropertyMetadata(new AITThrottleValveData(), FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
@ -79,6 +86,12 @@ namespace Aitex.Core.UI.DeviceControl
|
|||
}
|
||||
}
|
||||
|
||||
public ICommand CommandReset
|
||||
{
|
||||
get => (ICommand)GetValue(CommandResetProperty);
|
||||
set => SetValue(CommandResetProperty, value);
|
||||
}
|
||||
|
||||
public bool IsManualModeValve
|
||||
{
|
||||
get
|
||||
|
@ -357,6 +370,7 @@ namespace Aitex.Core.UI.DeviceControl
|
|||
item.IsEnabled = false;
|
||||
mouseClickMenu.Items.Add(item);
|
||||
addOpenMenu(mouseClickMenu, item);
|
||||
addResetMenu(mouseClickMenu, item);
|
||||
//addSetPositionToZeroMenu(mouseClickMenu, item);
|
||||
mouseClickMenu.IsOpen = true;
|
||||
|
||||
|
@ -380,6 +394,15 @@ namespace Aitex.Core.UI.DeviceControl
|
|||
mouseClickMenu.Items.Add(item);
|
||||
}
|
||||
|
||||
void addResetMenu(ContextMenu mouseClickMenu, MenuItem item)
|
||||
{
|
||||
item = new MenuItem();
|
||||
item.Header = "Reset";
|
||||
item.Click += TurnOnReset;
|
||||
item.Tag = this.Tag;
|
||||
mouseClickMenu.Items.Add(item);
|
||||
}
|
||||
|
||||
void addCloseMenu(ContextMenu mouseClickMenu, MenuItem item)
|
||||
{
|
||||
item = new MenuItem();
|
||||
|
@ -433,6 +456,28 @@ namespace Aitex.Core.UI.DeviceControl
|
|||
}
|
||||
}
|
||||
|
||||
private void TurnOnReset(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (CommandReset != null || clickAct != null)
|
||||
{
|
||||
AITValveData deviceData = OnOff as AITValveData;
|
||||
if (deviceData != null)
|
||||
{
|
||||
deviceData.SetPoint = true;
|
||||
}
|
||||
}
|
||||
if (CommandReset != null)
|
||||
{
|
||||
KeyValuePair<string, string> pair = new KeyValuePair<string, string>(((MenuItem)e.Source).Tag + "", "true");
|
||||
|
||||
CommandReset.Execute(pair);
|
||||
}
|
||||
else if (clickAct != null)
|
||||
{
|
||||
clickAct(((MenuItem)e.Source).Tag + "", "true");
|
||||
}
|
||||
}
|
||||
|
||||
private void TurnPositionToZero(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SetPositionToZero();
|
||||
|
|
Loading…
Reference in New Issue