Browse Source

增加DEBUG

master
applelon 2 years ago
parent
commit
c635375ad6
21 changed files with 1070 additions and 1 deletions
  1. +13
    -0
      HBLConsole.Debug/App.xaml
  2. +17
    -0
      HBLConsole.Debug/App.xaml.cs
  3. +19
    -0
      HBLConsole.Debug/Bootstrapper.cs
  4. +131
    -0
      HBLConsole.Debug/Debug_MORKIC.xaml
  5. +28
    -0
      HBLConsole.Debug/Debug_MORKIC.xaml.cs
  6. +3
    -0
      HBLConsole.Debug/FodyWeavers.xml
  7. +25
    -0
      HBLConsole.Debug/HBLConsole.Debug.csproj
  8. +16
    -0
      HBLConsole.Debug/Pages/ShellView.xaml
  9. +15
    -0
      HBLConsole.Debug/Pages/ShellView.xaml.cs
  10. +8
    -0
      HBLConsole.Debug/Pages/ShellViewModel.cs
  11. +122
    -0
      HBLConsole.Debug/ViewModel/ViewModel_MORKIC.cs
  12. +12
    -0
      HBLConsole.Factory/SimpleFactory.cs
  13. +545
    -0
      HBLConsole.MORKIC/AlarmView.xaml
  14. +6
    -0
      HBLConsole.sln
  15. +1
    -0
      HBLConsole/HBLConsole.csproj
  16. +19
    -0
      HBLConsole/View/DebugContainer.xaml
  17. +30
    -0
      HBLConsole/View/DebugContainer.xaml.cs
  18. +1
    -1
      HBLConsole/View/MainView.xaml
  19. +39
    -0
      HBLConsole/ViewModel/DebugContainerViewModel.cs
  20. +8
    -0
      HBLDevice.Coffee/CommandEvent.cs
  21. +12
    -0
      HBLDevice.Coffee/CommandHandler.cs

+ 13
- 0
HBLConsole.Debug/App.xaml View File

@@ -0,0 +1,13 @@
<Application x:Class="HBLConsole.Debug.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:local="clr-namespace:HBLConsole.Debug">
<Application.Resources>
<s:ApplicationLoader>
<s:ApplicationLoader.Bootstrapper>
<local:Bootstrapper/>
</s:ApplicationLoader.Bootstrapper>
</s:ApplicationLoader>
</Application.Resources>
</Application>

+ 17
- 0
HBLConsole.Debug/App.xaml.cs View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace HBLConsole.Debug
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

+ 19
- 0
HBLConsole.Debug/Bootstrapper.cs View File

@@ -0,0 +1,19 @@
using HBLConsole.Debug.Pages;
using Stylet;
using StyletIoC;

namespace HBLConsole.Debug
{
public class Bootstrapper : Bootstrapper<ShellViewModel>
{
protected override void ConfigureIoC(IStyletIoCBuilder builder)
{
// Configure the IoC container in here
}

protected override void Configure()
{
// Perform any other configuration before the application starts
}
}
}

+ 131
- 0
HBLConsole.Debug/Debug_MORKIC.xaml View File

@@ -0,0 +1,131 @@
<UserControl x:Class="HBLConsole.Debug.Debug_MORKIC"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:HBLConsole.Debug"
mc:Ignorable="d"
xmlns:s="https://github.com/canton7/Stylet"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<local:ViewModel_MORKIC x:Name="vmode" />
</UserControl.DataContext>

<Grid>
<Grid.Resources>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<GroupBox Header="乐白" Grid.ColumnSpan="2"></GroupBox>
<GroupBox Header="冰淇淋机" Grid.Row="1" Grid.Column="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid >
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0">预冷温度</TextBlock>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding YLWD}"></TextBlock>
<TextBlock Grid.Row="0" Grid.Column="2">回气温度</TextBlock>
<TextBlock Grid.Row="0" Grid.Column="3" Text="{Binding HQWD}"></TextBlock>

<TextBlock Grid.Row="1" Grid.Column="0">环境温度</TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding HJWD}"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="2">当前模式</TextBlock>
<TextBlock Grid.Row="1" Grid.Column="3" Text="{Binding CurrentMode}"></TextBlock>

<TextBlock Grid.Row="2" Grid.Column="0">电流</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding DL}"></TextBlock>
<TextBlock Grid.Row="2" Grid.Column="2">电压</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="3" Text="{Binding DY}"></TextBlock>

<TextBlock Grid.Row="3" Grid.Column="0">成型比</TextBlock>
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding CXB}"></TextBlock>
<TextBlock Grid.Row="3" Grid.Column="2">故障</TextBlock>
<TextBlock Grid.Row="3" Grid.Column="3" Text="{Binding IceCreamFault}"></TextBlock>
</Grid>
<StackPanel Grid.Row="1" Orientation="Vertical">
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<TextBlock>饮品</TextBlock>
<Button Content="制作" s:View.ActionTarget="{Binding RelativeSource={Binding Self}}" Command="{s:Action MakeIceCream}" ></Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<TextBlock>模式</TextBlock>
<ComboBox Width="100" ItemsSource="{Binding IceCreamModes}" SelectedItem="{Binding SelecteIceCreamdMode}"></ComboBox>
<Button Content="设置" s:View.ActionTarget="{Binding RelativeSource={Binding Self}}" Command="{s:Action SetIceCreamModel}" ></Button>
</StackPanel>
</StackPanel>
</Grid>
</GroupBox>
<GroupBox Header="咖啡机" Grid.Row="1" Grid.Column="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid >
<Grid.Resources>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="150"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0">咖啡机状态</TextBlock>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding CoffeeStatus}"></TextBlock>
<TextBlock Grid.Row="0" Grid.Column="2">应用状态</TextBlock>
<TextBlock Grid.Row="0" Grid.Column="3" Text="{Binding AppStatus}"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="0">告警信息</TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Warning}"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="2">故障信息</TextBlock>
<TextBlock Grid.Row="1" Grid.Column="3" Text="{Binding CaffeeFault}"></TextBlock>
</Grid>
<StackPanel Grid.Row="1" Orientation="Vertical">
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<TextBlock>饮品</TextBlock>
<ComboBox Width="100" ItemsSource="{Binding Coffees}" SelectedItem="{Binding SelectedCoffee}"></ComboBox>
<Button Content="制作" s:View.ActionTarget="{Binding RelativeSource={Binding Self}}" Command="{s:Action MakeCoffee}" ></Button>
<Button Content="停止制作" s:View.ActionTarget="{Binding RelativeSource={Binding Self}}" Command="{s:Action StopMakeCoffee}"></Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<TextBlock>模式</TextBlock>
<ComboBox Width="100" ItemsSource="{Binding CoffeeCmds}" SelectedItem="{Binding SelectedCoffeeCmd}"></ComboBox>
<Button Content="设置" s:View.ActionTarget="{Binding RelativeSource={Binding Self}}" Command="{s:Action SetCoffeeModel}"></Button>
</StackPanel>
</StackPanel>
</Grid>

</GroupBox>
</Grid>
</UserControl>

+ 28
- 0
HBLConsole.Debug/Debug_MORKIC.xaml.cs View File

@@ -0,0 +1,28 @@
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 HBLConsole.Debug
{
/// <summary>
/// Debug_MORKIC.xaml 的交互逻辑
/// </summary>
public partial class Debug_MORKIC : UserControl
{
public Debug_MORKIC()
{
InitializeComponent();
}
}
}

+ 3
- 0
HBLConsole.Debug/FodyWeavers.xml View File

@@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged />
</Weavers>

+ 25
- 0
HBLConsole.Debug/HBLConsole.Debug.csproj View File

@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<RootNamespace>HBLConsole.Debug</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Stylet" Version="1.3.6.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\HBLDevice.Coffee\HBLDevice.Coffee.csproj" />
<ProjectReference Include="..\HBLDevice.IceCream\HBLDevice.IceCream.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="BPA.Utility">
<HintPath>..\..\..\BPACommon_output\net5.0\BPA.Utility.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

+ 16
- 0
HBLConsole.Debug/Pages/ShellView.xaml View File

@@ -0,0 +1,16 @@
<Window x:Class="HBLConsole.Debug.Pages.ShellView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:local="clr-namespace:HBLConsole.Debug.Pages"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:ShellViewModel}"
Title="Stylet Project" Height="450" Width="800">
<Grid>
<TextBlock FontSize="30" HorizontalAlignment="Center" VerticalAlignment="Center">
Hello Stylet!
</TextBlock>
</Grid>
</Window>

+ 15
- 0
HBLConsole.Debug/Pages/ShellView.xaml.cs View File

@@ -0,0 +1,15 @@
using System.Windows;

namespace HBLConsole.Debug.Pages
{
/// <summary>
/// Interaction logic for ShellView.xaml
/// </summary>
public partial class ShellView : Window
{
public ShellView()
{
InitializeComponent();
}
}
}

+ 8
- 0
HBLConsole.Debug/Pages/ShellViewModel.cs View File

@@ -0,0 +1,8 @@
using Stylet;

namespace HBLConsole.Debug.Pages
{
public class ShellViewModel : Screen
{
}
}

+ 122
- 0
HBLConsole.Debug/ViewModel/ViewModel_MORKIC.cs View File

@@ -0,0 +1,122 @@
using BPA.Utility;
using HBLDevice.Coffee;
using HBLDevice.IceCream;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HBLConsole.Debug
{
internal class ViewModel_MORKIC
{
#region 咖啡机
/// <summary>
/// 咖啡机状态
/// </summary>
public DrCoffeeStatus CoffeeStatus { get; set; }
/// <summary>
/// 应用状态
/// </summary>
public DrCoffeeAppStatus AppStatus { get; set; }
public DrCoffeeWarning Warning { get; set; }
/// <summary>
/// 故障信息
/// </summary>
public DrCoffeeFault CaffeeFault { get; set; }

public List<string> Coffees { get; set; } = new List<string>();
public string SelectedCoffee { get; set; }

public List<string> CoffeeCmds { get; set; } = new List<string>();
public string SelectedCoffeeCmd { get; set; }
#endregion

#region 冰淇淋
/// <summary>
/// 预冷温度
/// </summary>
public short YLWD { get; set; }
/// <summary>
/// 回气温度
/// </summary>
public short HQWD { get; set; }
/// <summary>
/// 环境温度
/// </summary>
public short HJWD { get; set; }
/// <summary>
/// 电流
/// </summary>
public short DL { get; set; }
/// <summary>
/// 电压
/// </summary>
public short DY { get; set; }
/// <summary>
/// 当前模式
/// </summary>
public MORKI_MODE CurrentMode { get; set; }
/// <summary>
/// 故障
/// </summary>
public MORKI_FAULT IceCreamFault { get; set; }
/// <summary>
/// 成型比
/// </summary>
public byte CXB { get; set; }

public List<string> IceCreamModes { get; set; } = new List<string>();
public string SelecteIceCreamdMode { get; set; }
#endregion

public ViewModel_MORKIC()
{
foreach (DrCoffeeDrinksCode code in Enum.GetValues(typeof(DrCoffeeDrinksCode)))
{
Coffees.Add(code.ToString());
}
SelectedCoffee = Coffees[0];
foreach (DrCoffeeCommCmd code in Enum.GetValues(typeof(DrCoffeeCommCmd)))
{
CoffeeCmds.Add(code.ToString());
}
SelectedCoffeeCmd = CoffeeCmds[0];

foreach (MORKI_MODE code in Enum.GetValues(typeof(MORKI_MODE)))
{
IceCreamModes.Add(code.ToString());
}
SelecteIceCreamdMode = IceCreamModes[0];
}

public void MakeIceCream()
{
DischargeEvent dischargeEvent = new DischargeEvent();
dischargeEvent.Publish();
}

public void SetIceCreamModel()
{
ModeSetEvent modeSetEvent = new ModeSetEvent();
modeSetEvent.Mode = (MORKI_MODE)Enum.Parse(typeof(MORKI_MODE), SelecteIceCreamdMode);
modeSetEvent.Publish();
}

public void MakeCoffee()
{
new MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)Enum.Parse(typeof(DrCoffeeDrinksCode), SelectedCoffeeCmd) }.Publish();
}

public void StopMakeCoffee()
{
new CancelMakeCoffeeEvent().Publish();
}

public void SetCoffeeModel()
{
new CoffeeCommCmdEvent() { CommCmd = (DrCoffeeCommCmd)Enum.Parse(typeof(DrCoffeeCommCmd), SelectedCoffeeCmd) }.Publish();
}
}
}

+ 12
- 0
HBLConsole.Factory/SimpleFactory.cs View File

@@ -22,6 +22,8 @@ namespace HBLConsole.Factory

private string DeviceType => GeneralConfig.DeviceType.ToString();

private object debugControl;

public void MqttMessage(IMessage message)
{
GetAbsMessageServer.AddOrder(message);
@@ -72,6 +74,7 @@ namespace HBLConsole.Factory
/// </summary>
public void DeviceInit()
{
return;
string NameSpace = $"HBLConsole.{DeviceType}";//Load 加载的是dll的名称,GetType获取的是全命名空间下的类
Type type = Assembly.Load(NameSpace).GetType($"{NameSpace}.Control_{DeviceType}");
control = Activator.CreateInstance(type) as IControl;
@@ -103,5 +106,14 @@ namespace HBLConsole.Factory
}
return default;
}

public object GetDebugControl()
{
if (null == debugControl)
{
debugControl = Assembly.Load("HBLConsole.Debug").CreateInstance($"HBLConsole.Debug.Debug_{DeviceType}");
}
return debugControl;
}
}
}

+ 545
- 0
HBLConsole.MORKIC/AlarmView.xaml View File

@@ -0,0 +1,545 @@
<UserControl
x:Class="HBLConsole.View.AlarmView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:convert="clr-namespace:HBLConsole.Converter"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:HBLConsole.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:HBLConsole.PryUserControl;assembly=HBLConsole.PryUserControl"
xmlns:vm="clr-namespace:HBLConsole.ViewModel"
d:DesignHeight="450"
d:DesignWidth="1000"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:AlarmViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>

<ResourceDictionary Source="../Resources/ResourceDictionarys/BasicStyle.xaml" />
<!--<ResourceDictionary Source="../Resources/ResourceDictionarys/DatePickeerDictionary.xaml"/>-->

<ResourceDictionary>
<convert:TextDisplayConvert x:Key="textDisplayConvert" />
<convert:IsEnableConvert x:Key="isEnableConvert" />
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" />
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" />
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<ControlTemplate x:Key="ButTemplate" TargetType="Button">
<Border
x:Name="br"
Background="Transparent"
BorderBrush="#FF19B7EC"
BorderThickness="2">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<ContentControl
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

<Trigger Property="IsPressed" Value="true">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

</ControlTemplate.Triggers>
</ControlTemplate>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">

<!--<DatePicker
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding StartDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入开始时间"
Visibility="{Binding IsVisibilityDatePicker}" />-->

<!--<DatePicker
Margin="20,0,0,0"
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding EndDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入结束时间"
Visibility="{Binding IsVisibilityDatePicker}" />-->

<Button
Width="140"
Background="#FF19B7EC"
Command="{Binding SwitchCommand}"
Content="开始查询"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

<Button
Width="140"
Background="#FF19B7EC"
Command="{Binding SwitchCommand}"
Content="{Binding ButContent}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

</StackPanel>

<!--#region 表格标题栏设置-->
<Grid Grid.Row="1" Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="ID" />

<Grid Grid.Column="1">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警日期" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警时间" />

<Grid Grid.Column="3">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警信息" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警值" />

<Grid Grid.Column="5">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警等级" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
</Grid>
<!--#endregion-->

<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="2"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding varialeInfos}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr">
<Grid.ColumnDefinitions>
<!--<ColumnDefinition Width="40" />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="0" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="100" />-->
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding ID}" />

<Grid Grid.Column="1">
<TextBox
Background="Transparent"
CaretBrush="{StaticResource CursorColor}"
Foreground="{StaticResource FontColor}"
Style="{StaticResource InputTextboxStyle}"
TabIndex="{Binding ID}"
Text="{Binding VarName}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>


<TextBox
Grid.Column="2"
Background="Transparent"
CaretBrush="{StaticResource CursorColor}"
Foreground="{StaticResource FontColor}"
Style="{StaticResource InputTextboxStyle}"
TabIndex="{Binding ID}"
Text="{Binding Address}" />

<Grid Grid.Column="3">
<ComboBox
VerticalAlignment="Center"
BorderBrush="Transparent"
BorderThickness="1"
FontFamily="楷体"
FontSize="20"
Foreground="{StaticResource FontColor}"
IsEditable="False"
ItemsSource="{Binding dataType}"
SelectedValue="{Binding DataType}"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding DataType}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>


<Grid Grid.Column="5">
<CheckBox
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#ff23CACA"
Content="{Binding IsEnableAlarm, Converter={StaticResource textDisplayConvert}}"
FontSize="16"
Foreground="{StaticResource FontColor}"
IsChecked="{Binding IsEnableAlarm}"
Template="{StaticResource CbTemplate}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="0,0,1,0" />
</Grid>

<Grid Grid.Column="6">
<Grid>
<ToggleButton
Name="tb"
Width="{Binding RelativeSource={RelativeSource AncestorType=Grid, AncestorLevel=1}, Path=ActualWidth}"
Height="{Binding RelativeSource={RelativeSource AncestorType=Grid, AncestorLevel=1}, Path=ActualHeight}"
Background="Transparent"
BorderThickness="0"
Content="编辑"
FontSize="14"
IsChecked="{Binding IsOpen}"
IsEnabled="{Binding IsEnableAlarm}"
Style="{StaticResource EditToggleButtonStyle}" />
</Grid>

<!-- 当 StaysOpen 设置为 True 时 popup失去焦点的时候不会自动关闭 -->
<Popup
AllowsTransparency="True"
Focusable="False"
IsOpen="{Binding IsOpen}"
Placement="Left"
PlacementTarget="{Binding ElementName=tb}"
StaysOpen="False">
<Border Background="#081424" ClipToBounds="True">
<Grid Margin="0">
<Grid.Background>
<ImageBrush ImageSource="../Resources/Images/边框1.png" />
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<!--#region 离散量报警设置-->
<StackPanel
Grid.Row="0"
Margin="10"
Orientation="Vertical"
Visibility="{Binding DataType, Converter={StaticResource discreteAlarmConvert}}">

<Grid Margin="5">
<pry:TitleTextBlock />
<TextBlock
Margin="10,5,30,5"
Background="Transparent"
FontSize="16"
Foreground="#dd01FFFF"
Text="离散量报警设置" />
</Grid>

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Margin="5"
Style="{StaticResource TextBlockStyle}"
Text="选择触发条件:" />

<ComboBox
Grid.Column="1"
Width="180"
Margin="5"
VerticalAlignment="Center"
BorderBrush="#FF23CACA"
BorderThickness="1"
FontFamily="楷体"
FontSize="20"
Foreground="#ff23caca"
IsEditable="False"
ItemsSource="{Binding PopupDiscreteAlarmType}"
SelectedIndex="1"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding AlarmSetProp.DiscreteAlarmInfoSet.TrigAlarm}" />
</Grid>

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
Margin="5"
Style="{StaticResource TextBlockStyle}"
Text="输入报警信息:" />
<TextBox
Grid.Column="1"
Grid.ColumnSpan="2"
Margin="5"
Style="{StaticResource TextBoxStyle}"
Text="{Binding AlarmSetProp.DiscreteAlarmInfoSet.AlarmInfo}" />
</Grid>

</StackPanel>
<!--#endregion-->

<!--#region 模拟量报警设置-->
<StackPanel
Grid.Row="1"
Margin="10"
Visibility="{Binding DataType, Converter={StaticResource analogAlarmConvert}}">

<Grid Margin="5">
<pry:TitleTextBlock />
<TextBlock
Margin="10,5,30,5"
Background="Transparent"
FontSize="16"
Foreground="#dd01FFFF"
Text="模拟量报警设置" />
</Grid>

<ItemsControl ItemsSource="{Binding AlarmSetProp.AnalogAlarmModels}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<CheckBox
Margin="5,5,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Background="#ff23CACA"
Content="{Binding AlarmTag}"
FontSize="14"
Foreground="#ff23CACA"
IsChecked="{Binding IsEnable}"
Template="{StaticResource CbTemplate}" />

<TextBlock
Grid.Column="1"
Margin="0,5,5,0"
Style="{StaticResource TextBlockStyle}"
Text="请输入报警值:" />
<TextBox
Grid.Column="2"
Width="100"
Margin="0,5,5,0"
IsEnabled="{Binding IsEnable}"
Style="{StaticResource TextBoxStyle}"
Text="{Binding AlarmValue}" />

<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="5"
Style="{StaticResource TextBlockStyle}"
Text="输入报警信息:" />
<TextBox
Grid.Row="1"
Grid.Column="1"
Grid.ColumnSpan="2"
Margin="5"
IsEnabled="{Binding IsEnable}"
Style="{StaticResource TextBoxStyle}"
Text="{Binding AlarmInfo}" />

</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

</StackPanel>
<!--#endregion-->

<!--#region 按钮控制-->
<Grid Grid.Row="2" Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Margin="10,5,10,10"
Command="{Binding CancelCommand}"
Content="取消"
FontFamily="楷体"
FontSize="20"
Foreground="#aa01FFFF"
Template="{StaticResource CancelButtonTemp}" />

<Button
Grid.Column="1"
Margin="10,5,10,10"
Command="{Binding ConfirmCommand}"
Content="确认"
FontFamily="楷体"
FontSize="20"
Foreground="#aa01FFFF"
Template="{StaticResource ConfirmButtonTemp}" />
</Grid>
<!--#endregion-->

</Grid>
</Border>
</Popup>
</Grid>

<Border
Grid.ColumnSpan="8"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<!--#endregion-->


</Grid>
</UserControl>

+ 6
- 0
HBLConsole.sln View File

@@ -41,6 +41,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HBLDevice.Coffee", "HBLDevi
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HBLDevice.IceCream", "HBLDevice.IceCream\HBLDevice.IceCream.csproj", "{6F9FD1DA-D17A-4243-83F3-E24ADC0B8CF7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HBLConsole.Debug", "HBLConsole.Debug\HBLConsole.Debug.csproj", "{8F75DF03-50F7-4ECF-8535-E59E6486B652}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -119,6 +121,10 @@ Global
{6F9FD1DA-D17A-4243-83F3-E24ADC0B8CF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F9FD1DA-D17A-4243-83F3-E24ADC0B8CF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F9FD1DA-D17A-4243-83F3-E24ADC0B8CF7}.Release|Any CPU.Build.0 = Release|Any CPU
{8F75DF03-50F7-4ECF-8535-E59E6486B652}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8F75DF03-50F7-4ECF-8535-E59E6486B652}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8F75DF03-50F7-4ECF-8535-E59E6486B652}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8F75DF03-50F7-4ECF-8535-E59E6486B652}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE


+ 1
- 0
HBLConsole/HBLConsole.csproj View File

@@ -194,6 +194,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\HBLConsole.Debug\HBLConsole.Debug.csproj" />
<ProjectReference Include="..\HBLConsole.MainConsole\HBLConsole.MainConsole.csproj" />
<ProjectReference Include="..\HBLConsole.Model\HBLConsole.Model.csproj" />
<ProjectReference Include="..\HBLConsole.MORKD\HBLConsole.MORKD.csproj" />


+ 19
- 0
HBLConsole/View/DebugContainer.xaml View File

@@ -0,0 +1,19 @@
<UserControl x:Class="HBLConsole.View.DebugContainer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:HBLConsole.View"
mc:Ignorable="d"
xmlns:vm="clr-namespace:HBLConsole.ViewModel"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:DebugContainerViewModel />
</UserControl.DataContext>
<Grid>
<ContentControl
Grid.Row="1"
Margin="15"
Content="{Binding DebugContent}" />
</Grid>
</UserControl>

+ 30
- 0
HBLConsole/View/DebugContainer.xaml.cs View File

@@ -0,0 +1,30 @@
using HBLConsole.Factory;
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 HBLConsole.View
{
/// <summary>
/// DebugContainer.xaml 的交互逻辑
/// </summary>
public partial class DebugContainer : UserControl
{
public DebugContainer()
{
InitializeComponent();
}
}
}

+ 1
- 1
HBLConsole/View/MainView.xaml View File

@@ -208,7 +208,7 @@
<RadioButton
Margin="-10,0,0,0"
Command="{Binding NavChangedCommand}"
CommandParameter="DebugView"
CommandParameter="DebugContainer"
Content="调试模式"
Style="{StaticResource ParallelogramRadioButtonStyle}" />



+ 39
- 0
HBLConsole/ViewModel/DebugContainerViewModel.cs View File

@@ -0,0 +1,39 @@
using HBLConsole.Factory;
using HBLConsole.View;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace HBLConsole.ViewModel
{
public class DebugContainerViewModel : ViewModelBase
{
private FrameworkElement debugContent;

public FrameworkElement DebugContent
{
get { return debugContent; }
set
{
debugContent = value;
OnPropertyChanged();
}
}

public DebugContainerViewModel()
{
var ctrl = SimpleFactory.GetInstance.GetDebugControl();
if (null == ctrl)
{
DebugContent = new DebugView();
}
else
{
DebugContent = (FrameworkElement)ctrl;
}
}
}
}

+ 8
- 0
HBLDevice.Coffee/CommandEvent.cs View File

@@ -22,6 +22,14 @@ namespace HBLDevice.Coffee
{
}

/// <summary>
/// 模式设置
/// </summary>
public class CoffeeCommCmdEvent : IEvent
{
public DrCoffeeCommCmd CommCmd { get; set; }
}

/// <summary>
/// 开始制作
/// </summary>


+ 12
- 0
HBLDevice.Coffee/CommandHandler.cs View File

@@ -33,6 +33,18 @@ namespace HBLDevice.Coffee

EventBus.GetInstance().Subscribe<MakeCoffeeEvent>(MakeCoffeeEventHandle);
EventBus.GetInstance().Subscribe<CancelMakeCoffeeEvent>(CancelMakeCoffeeEventHandle);
EventBus.GetInstance().Subscribe<CoffeeCommCmdEvent>(CoffeeCommCmdEventHandle);

}

private void CoffeeCommCmdEventHandle(IEvent @event, EventBus.EventCallBackHandle callBack)
{
PauseAsk?.Invoke(true);
Thread.Sleep(200);
drinksOrder.CommCmd = ((CoffeeCommCmdEvent)@event).CommCmd;
commProxy.SendData(DrCoffee.Packe(drinksOrder));
Thread.Sleep(200);
PauseAsk?.Invoke(false);
}

private void CancelMakeCoffeeEventHandle(IEvent @event, EventBus.EventCallBackHandle callBack)


Loading…
Cancel
Save