@@ -0,0 +1,40 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System.Collections.ObjectModel; | |||
namespace HBLConsole.Model | |||
{ | |||
/// <summary> | |||
/// 流程数据信息 | |||
/// </summary> | |||
public class ProcessConditions : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 流程标题 | |||
/// </summary> | |||
public string ProcessTitl { get { return _mProcessTitl; } set { _mProcessTitl = value; OnPropertyChanged(); } } | |||
private string _mProcessTitl; | |||
public ObservableCollection<Condition> Conditions { get; set; } = new ObservableCollection<Condition>(); | |||
} | |||
public class Condition : ObservableObject | |||
{ | |||
public bool ConditionMet { get { return _mConditionMet; } set { _mConditionMet = value; OnPropertyChanged(); } } | |||
private bool _mConditionMet; | |||
public string ConditionName { get { return _mConditionName; } set { _mConditionName = value; OnPropertyChanged(); } } | |||
private string _mConditionName; | |||
} | |||
} |
@@ -255,6 +255,7 @@ | |||
Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" /> | |||
</Grid> | |||
<!--使用多条件触发器--> | |||
<ControlTemplate.Triggers> | |||
<EventTrigger RoutedEvent="ScrollChanged"> | |||
<BeginStoryboard> | |||
@@ -16,57 +16,94 @@ | |||
<UserControl.Resources> | |||
<!--#region 按钮样式--> | |||
<Style x:Key="ButtonStyle" TargetType="Button"> | |||
<Setter Property="Foreground" Value="#00c2f4" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Width" Value="100" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="Button"> | |||
<Border | |||
Name="TitleBarBr" | |||
Background="Transparent" | |||
BorderBrush="#00c2f4" | |||
BorderThickness="2" | |||
CornerRadius="10"> | |||
<ContentPresenter | |||
Margin="{TemplateBinding Margin}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="TitleBarBr" Property="Background" Value="#3300c2f4" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
<!--#region 开关按钮样式--> | |||
<Style x:Key="ToggleButStyle" TargetType="ToggleButton"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="ToggleButton"> | |||
<Border | |||
Background="{TemplateBinding Background}" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}"> | |||
<ContentPresenter | |||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalAlignment}" | |||
Content="{TemplateBinding Content}" /> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="../Resources/ResourceDictionarys/BasicStyle.xaml"> | |||
<!--#region 按钮样式--> | |||
<Style x:Key="ButtonStyle" TargetType="Button"> | |||
<Setter Property="Foreground" Value="#00c2f4" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Width" Value="100" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="Button"> | |||
<Border | |||
Name="TitleBarBr" | |||
Background="Transparent" | |||
BorderBrush="#00c2f4" | |||
BorderThickness="2" | |||
CornerRadius="10"> | |||
<ContentPresenter | |||
Margin="{TemplateBinding Margin}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="TitleBarBr" Property="Background" Value="#3300c2f4" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
<!--#region 开关按钮样式--> | |||
<Style x:Key="ToggleButStyle" TargetType="{x:Type ToggleButton}"> | |||
<Setter Property="IsChecked" Value="False" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="Foreground" Value="#ddd" /> | |||
<Setter Property="IsEnabled" Value="False" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Margin" Value="3,0" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ToggleButton}"> | |||
<!--<Grid x:Name="gr" SnapsToDevicePixels="True">--> | |||
<Border | |||
Name="br" | |||
Background="#FF1E9614" | |||
CornerRadius="5"> | |||
<ContentPresenter | |||
x:Name="contentPresenter" | |||
Margin="4,2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
ContentStringFormat="{TemplateBinding ContentStringFormat}" | |||
ContentTemplate="{TemplateBinding ContentTemplate}" | |||
Focusable="False" | |||
RecognizesAccessKey="True" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</Border> | |||
<!--</Grid>--> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter TargetName="br" Property="Background" Value="#FF1E9614" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="False"> | |||
<Setter TargetName="br" Property="Background" Value="#FFF11A38" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<!--<Setter TargetName="tb" Property="Foreground" Value="#2695FF" />--> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
@@ -127,13 +164,46 @@ | |||
Style="{StaticResource ButtonStyle}" /> | |||
</StackPanel> | |||
<Grid Grid.Row="3"> | |||
<TextBlock Foreground="#ddd" Text="标题" /> | |||
<ToggleButton | |||
Content="aaa" | |||
Foreground="#ddd" | |||
Style="{StaticResource ToggleButStyle}" /> | |||
</Grid> | |||
<ScrollViewer | |||
Grid.Row="3" | |||
HorizontalScrollBarVisibility="Visible" | |||
Style="{StaticResource ScrollViewerStyle}" | |||
VerticalScrollBarVisibility="Visible"> | |||
<ItemsControl ItemsSource="{Binding processConditions}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<StackPanel Margin="0 5" VerticalAlignment="Center" Orientation="Horizontal"> | |||
<TextBlock | |||
VerticalAlignment="Center" | |||
Foreground="#ddd" | |||
Text="{Binding ProcessTitl}" /> | |||
<ListBox | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding Conditions}"> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<VirtualizingStackPanel Orientation="Horizontal" /> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<ToggleButton | |||
Content="{Binding ConditionName}" | |||
IsChecked="{Binding ConditionMet}" | |||
Style="{StaticResource ToggleButStyle}" /> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</StackPanel> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
@@ -11,6 +11,7 @@ | |||
Title="MainView" | |||
Width="1400" | |||
Height="850" | |||
Topmost="True" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
WindowStartupLocation="CenterScreen" | |||
@@ -10,6 +10,7 @@ using HBLConsole.Business.Devices; | |||
using System.ComponentModel; | |||
using System.Runtime.CompilerServices; | |||
using HBLConsole.Communication; | |||
using HBLConsole.Model; | |||
namespace HBLConsole.ViewModel | |||
{ | |||
@@ -21,7 +22,7 @@ namespace HBLConsole.ViewModel | |||
SimOrderCommand = new RelayCommand(() => { ActionManagerment.GetInstance.Send("SimOrder"); }); | |||
InitCommand = new RelayCommand(() => { MORKS.GetInstance.DeviceInit(); }); | |||
ProcessCondition(); | |||
ThreadManagerment.GetInstance.StartLong(new Action(() => | |||
{ | |||
NoodleCount = MORKS.GetInstance.mORKS.RBTakeNoodleTask.Count; | |||
@@ -30,6 +31,77 @@ namespace HBLConsole.ViewModel | |||
}), "数据监控"); | |||
} | |||
private void ProcessCondition() | |||
{ | |||
ProcessConditions process = new ProcessConditions(); | |||
process.ProcessTitl = "机器人"; | |||
process.Conditions.Add(new Condition() { ConditionName = "机器人空闲", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "温度到达", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取面中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取碗中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "到面中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "出餐中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "机器人空闲", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "温度到达", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取面中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取碗中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "到面中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "出餐中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "机器人空闲", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "温度到达", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取面中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取碗中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "到面中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "出餐中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "机器人空闲", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "温度到达", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取面中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取碗中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "到面中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "出餐中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "机器人空闲", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "温度到达", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取面中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取碗中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "到面中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "出餐中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "机器人空闲", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "温度到达", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取面中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取碗中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "到面中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "出餐中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "机器人空闲", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "温度到达", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取面中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取碗中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "到面中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "出餐中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "机器人空闲", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "温度到达", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取面中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取碗中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "到面中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "出餐中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "机器人空闲", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "温度到达", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取面中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取碗中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "到面中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "出餐中", ConditionMet = false }); | |||
processConditions.Add(process); | |||
process = new ProcessConditions(); | |||
process.ProcessTitl = "取完机构"; | |||
process.Conditions.Add(new Condition() { ConditionName = "机器人空闲", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "温度到达", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取面中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "取碗中", ConditionMet = false }); | |||
process.Conditions.Add(new Condition() { ConditionName = "到面中", ConditionMet = true }); | |||
process.Conditions.Add(new Condition() { ConditionName = "出餐中", ConditionMet = true }); | |||
processConditions.Add(process); | |||
} | |||
public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged; | |||
private static void OnStaticPropertyChanged([CallerMemberName] string PropName = "") | |||
@@ -67,6 +67,14 @@ namespace HBLConsole.ViewModel | |||
public static string WindowName { get { return _mWindowName; } set { _mWindowName = value; OnStaticPropertyChanged(); } } | |||
private static string _mWindowName = string.Empty; | |||
#region 流程监控属性 | |||
/// <summary> | |||
/// 流程条件监控 | |||
/// </summary> | |||
public static ObservableCollection<ProcessConditions> processConditions { get; set; } = new ObservableCollection<ProcessConditions>(); | |||
#endregion | |||
#endregion | |||
/// <summary> | |||