@@ -33,7 +33,7 @@ namespace BPASmartClient.Business | |||
private List<RecivedHandle> messageRecives = new List<RecivedHandle>(); | |||
public void Initialize() | |||
{ | |||
} | |||
public void Start() | |||
@@ -90,8 +90,9 @@ namespace BPASmartClient.Business | |||
/// </summary> | |||
/// <param name="topic">主题</param> | |||
/// <param name="message">消息体</param> | |||
public void Publish(string topic, string message) { | |||
mqttProxy.Publish(topic, message); | |||
public void Publish(string topic, string message) | |||
{ | |||
mqttProxy.Publish(topic, message); | |||
} | |||
/// <summary> | |||
@@ -112,6 +113,6 @@ namespace BPASmartClient.Business | |||
messageRecives.Clear(); | |||
} | |||
} | |||
} |
@@ -1,32 +1,39 @@ | |||
<UserControl x:Class=" BPASmartClient.CustomResource.UserControls.DateTimeUI" | |||
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:BPASmartClient.CustomResource.UserControls" | |||
mc:Ignorable="d" | |||
d:DesignHeight="50" d:DesignWidth="100"> | |||
<UserControl | |||
x:Class=" BPASmartClient.CustomResource.UserControls.DateTimeUI" | |||
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:local="clr-namespace:BPASmartClient.CustomResource.UserControls" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
d:DesignHeight="50" | |||
d:DesignWidth="100" | |||
mc:Ignorable="d"> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml"/> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml"/> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30"></RowDefinition> | |||
<RowDefinition></RowDefinition> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" Grid.Row="0"> | |||
<TextBlock x:Name="time" FontSize="16">14:48:30</TextBlock> | |||
<Image Style="{DynamicResource timeImage}" Margin="10,0,0,0"></Image> | |||
<StackPanel Grid.Row="0" Orientation="Horizontal"> | |||
<TextBlock x:Name="time" FontSize="16">14:48:30</TextBlock> | |||
<Image Margin="10,0,0,0" Style="{DynamicResource timeImage}" /> | |||
</StackPanel> | |||
<StackPanel Grid.Row="1" Orientation="Horizontal"> | |||
<TextBlock x:Name="dateRL" FontSize="10">星期一</TextBlock> | |||
<StackPanel Grid.Row="1" Orientation="Horizontal"> | |||
<TextBlock x:Name="dateRL" FontSize="10">星期一</TextBlock> | |||
<TextBlock x:Name="date" Margin="10,0,0,0" FontSize="10">2021-11-13</TextBlock> | |||
<TextBlock | |||
x:Name="date" | |||
Margin="10,0,0,0" | |||
FontSize="10"> | |||
2021-11-13 | |||
</TextBlock> | |||
</StackPanel> | |||
</Grid> | |||
</UserControl> |
@@ -3,6 +3,7 @@ using BPASmartClient.Peripheral; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Reflection; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
@@ -13,6 +14,13 @@ namespace BPASmartClient.Device | |||
/// </summary> | |||
public abstract class BaseDevice : IDevice | |||
{ | |||
public BaseDevice() | |||
{ | |||
var t = this.GetType(); | |||
// t.Name 是继承该类的一个实体类名 | |||
// t.Namespace 是继承该类的一个实体类的命名空间 | |||
} | |||
/// <summary> | |||
/// 设备ID | |||
/// </summary> | |||
@@ -32,7 +40,7 @@ namespace BPASmartClient.Device | |||
/// <summary> | |||
/// 是否忙碌 | |||
/// </summary> | |||
public bool IsBusy { get;protected set; } | |||
public bool IsBusy { get; protected set; } | |||
/// <summary> | |||
/// 是否健康 | |||
/// </summary> | |||
@@ -44,7 +52,8 @@ namespace BPASmartClient.Device | |||
public void Initliaze(List<IPeripheral> peripherals) | |||
{ | |||
peripherals.ForEach(p => { | |||
peripherals.ForEach(p => | |||
{ | |||
p.DeviceId = this.DeviceId; | |||
p.Init(); | |||
}); | |||
@@ -13,6 +13,7 @@ using BPA.Message; | |||
using System.Linq; | |||
using BPASmartClient.Model.PLC; | |||
using System.Threading.Tasks; | |||
using System.Reflection; | |||
namespace BPASmartClient.MorkS | |||
{ | |||
@@ -30,6 +31,9 @@ namespace BPASmartClient.MorkS | |||
private RecipeBoms recipeBoms { get; set; } = new RecipeBoms(); | |||
int OrderCount; | |||
bool Initing; | |||
public override void StartMain() | |||
{ | |||
ServerInit(); | |||
@@ -1,5 +1,6 @@ | |||
using BPA.Message; | |||
using BPASmartClient.Business; | |||
using BPASmartClient.Device; | |||
using BPASmartClient.EventBus; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Message; | |||
@@ -37,13 +38,12 @@ namespace BPASmartClient | |||
{ | |||
new MainConsole().Start(); | |||
}), "启动主控制台"); | |||
} | |||
public void Initialize() | |||
{ | |||
this.ButClose.Click += (o,e) => { this.Close(); }; | |||
this.br.MouseLeftButtonDown += (o,e) => | |||
this.ButClose.Click += (o, e) => { this.Close(); }; | |||
this.br.MouseLeftButtonDown += (o, e) => | |||
{ | |||
if (e.ClickCount > 1) | |||
{ | |||
@@ -54,7 +54,7 @@ namespace BPASmartClient | |||
} | |||
this.DragMove(); | |||
}; | |||
MenuItem_Click(new MenuItem() {Tag= "LogView",Header="日志监视" },null); | |||
MenuItem_Click(new MenuItem() { Tag = "LogView", Header = "日志监视" }, null); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
@@ -63,15 +63,15 @@ namespace BPASmartClient | |||
//new DRCoffee_MakeCoffeeEvent() { Id = 1, DrinkCode= DrCoffeeDrinksCode.两杯意式浓缩 }.Publish(); | |||
//new DRCoffee_CoffeeCommCmdEvent() { Id = 1,CommCmd = DrCoffeeCommCmd.冲煮系统快速冲洗指令}.Publish(); | |||
MorkOrderPush morkOrderPush = new MorkOrderPush() { DeviceId=2}; | |||
var temp=BPAPackage.Make(morkOrderPush, 12, BPA.Message.Enum.DeviceClientType.MORKS); | |||
MorkOrderPush morkOrderPush = new MorkOrderPush() { DeviceId = 2 }; | |||
var temp = BPAPackage.Make(morkOrderPush, 12, BPA.Message.Enum.DeviceClientType.MORKS); | |||
Plugin.GetInstance().GetPlugin<MQTTMgr>().Publish("DOWN/MORKS/ORDER/12", temp.Serialize()); | |||
} | |||
/// <summary> | |||
/// 菜单切换栏 | |||
/// </summary> | |||
private void MenuItem_Click(object sender,RoutedEventArgs e) | |||
private void MenuItem_Click(object sender, RoutedEventArgs e) | |||
{ | |||
try | |||
{ | |||
@@ -81,7 +81,7 @@ namespace BPASmartClient | |||
if (type == null) return; | |||
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes); | |||
contentRegion.Content = (FrameworkElement)cti.Invoke(null); | |||
Title.Text = (sender as MenuItem).Header?.ToString()+"界面"; | |||
Title.Text = (sender as MenuItem).Header?.ToString() + "界面"; | |||
} | |||
} | |||
catch (Exception ex) | |||
@@ -92,9 +92,8 @@ namespace BPASmartClient | |||
private void Button_Click_1(object sender,RoutedEventArgs e) | |||
private void Button_Click_1(object sender, RoutedEventArgs e) | |||
{ | |||
} | |||
} | |||
} |