@@ -44,10 +44,10 @@ | |||
</ScrollViewer> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<!--<Trigger Property="IsEnabled" Value="false"> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Background" TargetName="Bd" Value="{StaticResource ListBox.Disabled.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource ListBox.Disabled.Border}"/> | |||
</Trigger>--> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsGrouping" Value="true"/> | |||
@@ -463,9 +463,9 @@ | |||
Background="#112AB2E7" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeCode}" | |||
CommandParameter="{Binding DeviceName}" | |||
Tag="{Binding DeviceName}" | |||
Click="IcoButton_Click" | |||
Content="启动" | |||
EnterBackground="#222AB2E7" | |||
Foreground="#FF2AB2E7" | |||
@@ -481,9 +481,9 @@ | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.StopCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeCode}" | |||
CommandParameter="{Binding DeviceName}" | |||
Tag="{Binding DeviceName}" | |||
Click="IcoButton_Click_1" | |||
Content="停止" | |||
EnterBackground="#22F53F62" | |||
Foreground="#FFF53F62" | |||
@@ -613,9 +613,9 @@ | |||
Background="#112AB2E7" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeCode}" | |||
CommandParameter="{Binding DeviceName}" | |||
Tag="{Binding DeviceName}" | |||
Click="IcoButton_Click_2" | |||
Content="启动" | |||
EnterBackground="#222AB2E7" | |||
Foreground="#FF2AB2E7" | |||
@@ -631,9 +631,9 @@ | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.StopCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeCode}" | |||
CommandParameter="{Binding DeviceName}" | |||
Tag="{Binding DeviceName}" | |||
Click="IcoButton_Click_3" | |||
Content="停止" | |||
EnterBackground="#22F53F62" | |||
Foreground="#FFF53F62" | |||
@@ -28,7 +28,11 @@ namespace BPASmartClient.JXJFoodBigStation.View | |||
{ | |||
InitializeComponent(); | |||
storyboard = Resources["Open"] as Storyboard; | |||
ActionManage.GetInstance.Register(new Action<string>((deviceName) => { | |||
ActionManage.GetInstance.CancelRegister("StartTopDevice"); | |||
ActionManage.GetInstance.CancelRegister("StopTopDevice"); | |||
ActionManage.GetInstance.CancelRegister("StartBottomDevice"); | |||
ActionManage.GetInstance.CancelRegister("StopBottomDevice"); | |||
ActionManage.GetInstance.Register(new Action<object>((deviceName) => { | |||
foreach (var item in this.FListView.Items) | |||
{ | |||
var myListBoxItem = (ListViewItem)FListView.ItemContainerGenerator.ContainerFromItem(item); | |||
@@ -43,7 +47,7 @@ namespace BPASmartClient.JXJFoodBigStation.View | |||
Path pt = obj as Path; | |||
if (pt != null) | |||
{ | |||
if (pt.Tag.ToString() == deviceName && storyboard != null) | |||
if (pt.Tag.ToString() == deviceName.ToString()&& storyboard != null) | |||
{ | |||
pt.Visibility = Visibility.Visible; | |||
pt.BeginStoryboard(storyboard); | |||
@@ -54,7 +58,7 @@ namespace BPASmartClient.JXJFoodBigStation.View | |||
}),"StartTopDevice" ); | |||
ActionManage.GetInstance.Register(new Action<string>((deviceName) => { | |||
ActionManage.GetInstance.Register(new Action<object>((deviceName) => { | |||
foreach (var item in this.FListView.Items) | |||
{ | |||
var myListBoxItem = (ListViewItem)FListView.ItemContainerGenerator.ContainerFromItem(item); | |||
@@ -69,7 +73,7 @@ namespace BPASmartClient.JXJFoodBigStation.View | |||
Path pt = obj as Path; | |||
if (pt != null) | |||
{ | |||
if (pt.Tag.ToString() == deviceName) | |||
if (pt.Tag.ToString() == deviceName.ToString()) | |||
pt.Visibility = Visibility.Collapsed; | |||
} | |||
@@ -77,7 +81,7 @@ namespace BPASmartClient.JXJFoodBigStation.View | |||
}), "StopTopDevice"); | |||
ActionManage.GetInstance.Register(new Action<string>((deviceName) => { | |||
ActionManage.GetInstance.Register(new Action<object>((deviceName) => { | |||
foreach (var item in this.buttonListView.Items) | |||
{ | |||
var myListBoxItem = (ListViewItem)buttonListView.ItemContainerGenerator.ContainerFromItem(item); | |||
@@ -92,7 +96,7 @@ namespace BPASmartClient.JXJFoodBigStation.View | |||
Path pt = obj as Path; | |||
if (pt != null) | |||
{ | |||
if (pt.Tag.ToString() == deviceName && storyboard != null) | |||
if (pt.Tag.ToString() == deviceName.ToString() && storyboard != null) | |||
{ | |||
pt.Visibility = Visibility.Visible; | |||
pt.BeginStoryboard(storyboard); | |||
@@ -101,9 +105,9 @@ namespace BPASmartClient.JXJFoodBigStation.View | |||
} | |||
} | |||
}), "StartBottonDevice"); | |||
}), "StartBottomDevice"); | |||
ActionManage.GetInstance.Register(new Action<string>((deviceName) => { | |||
ActionManage.GetInstance.Register(new Action<object>((deviceName) => { | |||
foreach (var item in this.buttonListView.Items) | |||
{ | |||
var myListBoxItem = (ListViewItem)buttonListView.ItemContainerGenerator.ContainerFromItem(item); | |||
@@ -118,13 +122,13 @@ namespace BPASmartClient.JXJFoodBigStation.View | |||
Path pt = obj as Path; | |||
if (pt != null) | |||
{ | |||
if (pt.Tag.ToString() == deviceName) | |||
if (pt.Tag.ToString() == deviceName.ToString()) | |||
pt.Visibility = Visibility.Collapsed; | |||
} | |||
} | |||
}), "StopBottonDevice"); | |||
}), "StopBottomDevice"); | |||
} | |||
//顶部启动下料动画 | |||
@@ -37,9 +37,50 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
Weight = new Random().Next(0, 100) | |||
}); | |||
} | |||
StartCommand = new RelayCommand<string>((deviceName) => { | |||
//PLC控制 | |||
//动画 | |||
if (deviceName != null) | |||
{ | |||
var top= TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | |||
if (top != null) | |||
{ | |||
ActionManage.GetInstance.Send("StartTopDevice", deviceName); | |||
} | |||
var bottom = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | |||
if (bottom != null) | |||
{ | |||
ActionManage.GetInstance.Send("StartBottomDevice", deviceName); | |||
} | |||
} | |||
}); | |||
StopCommand = new RelayCommand<string>((deviceName) => { | |||
//PLC控制 | |||
//动画 | |||
if (deviceName != null) | |||
{ | |||
var top = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | |||
if (top != null) | |||
{ | |||
ActionManage.GetInstance.Send("StopTopDevice", deviceName); | |||
} | |||
var bottom = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | |||
if (bottom != null) | |||
{ | |||
ActionManage.GetInstance.Send("StopBottomDevice", deviceName); | |||
} | |||
} | |||
}); | |||
} | |||
public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>(); | |||
public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>(); | |||
public RelayCommand<string> StartCommand { get; set; } | |||
public RelayCommand<string> StopCommand { get; set; } | |||
} | |||
} |