请求当前时序
This commit is contained in:
parent
66cf7d3bbc
commit
ead6ded30d
@ -1,11 +1,14 @@
|
||||
using InSituLaboratory.Common;
|
||||
using Azure;
|
||||
using InSituLaboratory.Common;
|
||||
using InSituLaboratory.Entities;
|
||||
using InSituLaboratory.Entities.SqlSugar;
|
||||
using InSituLaboratory.IService;
|
||||
using InSituLaboratory.IService.Sensor;
|
||||
using InSituLaboratory.Models;
|
||||
using InSituLaboratory.Service;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using Microsoft.EntityFrameworkCore.Query.Internal;
|
||||
using Prism.Commands;
|
||||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
@ -33,6 +36,7 @@ namespace InSituLaboratory.ViewModels.Pages
|
||||
public CurrentSequentiualModel CurrentSequentiual { get; set; } = new CurrentSequentiualModel(); //当前运行时序状态表
|
||||
public SequentStatusModel sequentStatusModel { get; set; } = new SequentStatusModel();
|
||||
|
||||
|
||||
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"^[0-9]\d*$");
|
||||
#endregion
|
||||
|
||||
@ -1530,6 +1534,40 @@ namespace InSituLaboratory.ViewModels.Pages
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 请求当前时序
|
||||
/// </summary>
|
||||
/// <param name="o"></param>
|
||||
public override void DoSync(object o)
|
||||
{
|
||||
string[] msg = o.ToString().Split(',');
|
||||
switch (msg[0])
|
||||
{
|
||||
//时序1
|
||||
case "sequent1":
|
||||
DoSyncSend(0x01);
|
||||
break;
|
||||
//时序2
|
||||
case "sequent2":
|
||||
DoSyncSend(0x02);
|
||||
break;
|
||||
//时序3
|
||||
case "sequent3":
|
||||
DoSyncSend(0x03);
|
||||
break;
|
||||
//时序4
|
||||
case "sequent4":
|
||||
DoSyncSend(0x04);
|
||||
break;
|
||||
//时序5
|
||||
case "sequent5":
|
||||
DoSyncSend(0x05);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
System.Windows.Forms.MessageBox.Show("已请求当前时序同步!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 转义封装
|
||||
@ -1596,7 +1634,7 @@ namespace InSituLaboratory.ViewModels.Pages
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 命令发送
|
||||
/// 命令发送 ---时序清空
|
||||
/// </summary>
|
||||
/// <param name="x1">时序号</param>
|
||||
/// <param name="x2">操作类型</param>
|
||||
@ -1612,6 +1650,22 @@ namespace InSituLaboratory.ViewModels.Pages
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 请求当前时序下发
|
||||
/// </summary>
|
||||
/// <param name="x1">时序组号</param>
|
||||
public void DoSyncSend(byte x1)
|
||||
{
|
||||
//消息体
|
||||
byte[] byteaq = new byte[] { 0x92, 0x02, 0x10, 0x01, 0x00, 0x00, 0x00, 0x01, x1 };
|
||||
List<byte> buffer = Escape(byteaq);
|
||||
string list = tools.byteToHexStr(buffer.ToArray());
|
||||
byte[] bytea = tools.ConvertHexStringToBytes(list);
|
||||
RelayViewModel.clientModel.SendData(bytea);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 时序下发封装数据域
|
||||
/// </summary>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Prism.Commands;
|
||||
using Microsoft.Identity.Client.NativeInterop;
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
@ -64,6 +65,8 @@ namespace InSituLaboratory.ViewModels.Pages
|
||||
public DelegateCommand StartCommand { get; set; }//一键启动
|
||||
public DelegateCommand SynchronizationCommand { get; set; }//时间同步
|
||||
|
||||
public DelegateCommand<object> SyncCommand { get; set; }//请求当前时序
|
||||
|
||||
|
||||
#region 时序1-5 刷新 新增/编辑 删除 下发 启动 暂停 清空
|
||||
|
||||
@ -124,6 +127,7 @@ namespace InSituLaboratory.ViewModels.Pages
|
||||
ReductionCommand = new DelegateCommand(DoReduction);
|
||||
StartCommand = new DelegateCommand(DoStart);
|
||||
SynchronizationCommand = new DelegateCommand(DoSynchronization);
|
||||
SyncCommand = new DelegateCommand<object>(DoSync);
|
||||
|
||||
#region 时序1-5 刷新 新增/编辑 删除 下发 启动 暂停 清空
|
||||
|
||||
@ -189,6 +193,7 @@ namespace InSituLaboratory.ViewModels.Pages
|
||||
public virtual void DoStart() { }
|
||||
public virtual void DoSynchronization() { }
|
||||
private string PageName { get; set; }
|
||||
public virtual void DoSync(object o) { }
|
||||
|
||||
|
||||
#region 时序1-5 刷新 新增/编辑 删除 下发 启动 暂停 清空
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:InSituLaboratory.Views.Pages"
|
||||
xmlns:converters="clr-namespace:InSituLaboratory.Base;assembly=InSituLaboratory.Base"
|
||||
xmlns:c="clr-namespace:InSituLaboratory.Controls;assembly=InSituLaboratory.Controls"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
@ -15,6 +16,7 @@
|
||||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<converters:BtnConvert x:Key="BtnConvert" />
|
||||
|
||||
<Style TargetType="{x:Type RadioButton}" x:Key="TopTabButtonStyle">
|
||||
<Setter Property="Height" Value="33"/>
|
||||
@ -51,6 +53,8 @@
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</ResourceDictionary>
|
||||
|
||||
|
||||
</UserControl.Resources>
|
||||
|
||||
<ScrollViewer>
|
||||
@ -167,6 +171,15 @@
|
||||
<Button Content="清空" Style="{StaticResource NormalButtonStyle}" Command="{Binding ClearS1Command}" Width="60" Margin="5,0" Background="#CD8C95"/>
|
||||
<Button Content="启动" Style="{StaticResource NormalButtonStyle}" Command="{Binding BeginS1Command}" Width="60" Margin="5,0" Background="#9400D3"/>
|
||||
<Button Content="暂停" Style="{StaticResource NormalButtonStyle}" Command="{Binding SuspendS1Command}" Width="60" Margin="5,0" Background="#CDC0B0"/>
|
||||
<Button Content="同步" Style="{StaticResource NormalButtonStyle}" Command="{Binding SyncCommand}" Width="60" Margin="5,0" Name="sequent1" Background="#CDB5CD">
|
||||
<Button.CommandParameter>
|
||||
<MultiBinding Converter="{StaticResource ResourceKey=BtnConvert}">
|
||||
<MultiBinding.Bindings>
|
||||
<Binding ElementName="sequent1" Path="Name" />
|
||||
</MultiBinding.Bindings>
|
||||
</MultiBinding>
|
||||
</Button.CommandParameter>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<!--数据源-->
|
||||
@ -275,6 +288,7 @@
|
||||
<!--刷新按钮-->
|
||||
<TextBlock Text="{Binding sequentStatusModel.Status2,Mode=TwoWay}" HorizontalAlignment="Center" VerticalAlignment="Center" Width="100" Foreground="#EE6363"/>
|
||||
<Button Content="刷新" Style="{StaticResource NormalButtonStyle}" Command="{Binding RefreshS2Command}" Width="60" Margin="5,0" Background="#88409EFE"/>
|
||||
|
||||
<Button Content="新建" Style="{StaticResource IconWithContentButtonStyle}" Command="{Binding ModifyS2Command}" Tag="" >
|
||||
<Button.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
|
||||
@ -287,6 +301,15 @@
|
||||
<Button Content="清空" Style="{StaticResource NormalButtonStyle}" Command="{Binding ClearS2Command}" Width="60" Margin="5,0" Background="#CD8C95"/>
|
||||
<Button Content="启动" Style="{StaticResource NormalButtonStyle}" Command="{Binding BeginS2Command}" Width="60" Margin="5,0" Background="#9400D3"/>
|
||||
<Button Content="暂停" Style="{StaticResource NormalButtonStyle}" Command="{Binding SuspendS2Command}" Width="60" Margin="5,0" Background="#CDC0B0"/>
|
||||
<Button Content="同步" Style="{StaticResource NormalButtonStyle}" Command="{Binding SyncCommand}" Width="60" Margin="5,0" Name="sequent2" Background="#CDB5CD">
|
||||
<Button.CommandParameter>
|
||||
<MultiBinding Converter="{StaticResource ResourceKey=BtnConvert}">
|
||||
<MultiBinding.Bindings>
|
||||
<Binding ElementName="sequent2" Path="Name" />
|
||||
</MultiBinding.Bindings>
|
||||
</MultiBinding>
|
||||
</Button.CommandParameter>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@ -396,6 +419,7 @@
|
||||
<!--刷新按钮-->
|
||||
<TextBlock Text="{Binding sequentStatusModel.Status3,Mode=TwoWay}" HorizontalAlignment="Center" VerticalAlignment="Center" Width="100" Foreground="#EE6363"/>
|
||||
<Button Content="刷新" Style="{StaticResource NormalButtonStyle}" Command="{Binding RefreshS3Command}" Width="60" Margin="5,0" Background="#88409EFE"/>
|
||||
|
||||
<Button Content="新建" Style="{StaticResource IconWithContentButtonStyle}" Command="{Binding ModifyS3Command}" Tag="" >
|
||||
<Button.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
|
||||
@ -408,6 +432,15 @@
|
||||
<Button Content="清空" Style="{StaticResource NormalButtonStyle}" Command="{Binding ClearS3Command}" Width="60" Margin="5,0" Background="#CD8C95"/>
|
||||
<Button Content="启动" Style="{StaticResource NormalButtonStyle}" Command="{Binding BeginS3Command}" Width="60" Margin="5,0" Background="#9400D3"/>
|
||||
<Button Content="暂停" Style="{StaticResource NormalButtonStyle}" Command="{Binding SuspendS3Command}" Width="60" Margin="5,0" Background="#CDC0B0"/>
|
||||
<Button Content="同步" Style="{StaticResource NormalButtonStyle}" Command="{Binding SyncCommand}" Width="60" Margin="5,0" Name="sequent3" Background="#CDB5CD">
|
||||
<Button.CommandParameter>
|
||||
<MultiBinding Converter="{StaticResource ResourceKey=BtnConvert}">
|
||||
<MultiBinding.Bindings>
|
||||
<Binding ElementName="sequent3" Path="Name" />
|
||||
</MultiBinding.Bindings>
|
||||
</MultiBinding>
|
||||
</Button.CommandParameter>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<!--数据源-->
|
||||
@ -516,6 +549,7 @@
|
||||
<!--刷新按钮-->
|
||||
<TextBlock Text="{Binding sequentStatusModel.Status4,Mode=TwoWay}" HorizontalAlignment="Center" VerticalAlignment="Center" Width="100" Foreground="#EE6363"/>
|
||||
<Button Content="刷新" Style="{StaticResource NormalButtonStyle}" Command="{Binding RefreshS4Command}" Width="60" Margin="5,0" Background="#88409EFE"/>
|
||||
|
||||
<Button Content="新建" Style="{StaticResource IconWithContentButtonStyle}" Command="{Binding ModifyS4Command}" Tag="" >
|
||||
<Button.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
|
||||
@ -528,6 +562,15 @@
|
||||
<Button Content="清空" Style="{StaticResource NormalButtonStyle}" Command="{Binding ClearS4Command}" Width="60" Margin="5,0" Background="#CD8C95"/>
|
||||
<Button Content="启动" Style="{StaticResource NormalButtonStyle}" Command="{Binding BeginS4Command}" Width="60" Margin="5,0" Background="#9400D3"/>
|
||||
<Button Content="暂停" Style="{StaticResource NormalButtonStyle}" Command="{Binding SuspendS4Command}" Width="60" Margin="5,0" Background="#CDC0B0"/>
|
||||
<Button Content="同步" Style="{StaticResource NormalButtonStyle}" Command="{Binding SyncCommand}" Width="60" Margin="5,0" Name="sequent4" Background="#CDB5CD">
|
||||
<Button.CommandParameter>
|
||||
<MultiBinding Converter="{StaticResource ResourceKey=BtnConvert}">
|
||||
<MultiBinding.Bindings>
|
||||
<Binding ElementName="sequent4" Path="Name" />
|
||||
</MultiBinding.Bindings>
|
||||
</MultiBinding>
|
||||
</Button.CommandParameter>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<!--数据源-->
|
||||
@ -636,6 +679,7 @@
|
||||
<!--刷新按钮-->
|
||||
<TextBlock Text="{Binding sequentStatusModel.Status5,Mode=TwoWay}" HorizontalAlignment="Center" VerticalAlignment="Center" Width="100" Foreground="#EE6363"/>
|
||||
<Button Content="刷新" Style="{StaticResource NormalButtonStyle}" Command="{Binding RefreshS5Command}" Width="60" Margin="5,0" Background="#88409EFE"/>
|
||||
|
||||
<Button Content="新建" Style="{StaticResource IconWithContentButtonStyle}" Command="{Binding ModifyS5Command}" Tag="" >
|
||||
<Button.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
|
||||
@ -648,6 +692,15 @@
|
||||
<Button Content="清空" Style="{StaticResource NormalButtonStyle}" Command="{Binding ClearS5Command}" Width="60" Margin="5,0" Background="#CD8C95"/>
|
||||
<Button Content="启动" Style="{StaticResource NormalButtonStyle}" Command="{Binding BeginS5Command}" Width="60" Margin="5,0" Background="#9400D3"/>
|
||||
<Button Content="暂停" Style="{StaticResource NormalButtonStyle}" Command="{Binding SuspendS5Command}" Width="60" Margin="5,0" Background="#CDC0B0"/>
|
||||
<Button Content="同步" Style="{StaticResource NormalButtonStyle}" Command="{Binding SyncCommand}" Width="60" Margin="5,0" Name="sequent5" Background="#CDB5CD">
|
||||
<Button.CommandParameter>
|
||||
<MultiBinding Converter="{StaticResource ResourceKey=BtnConvert}">
|
||||
<MultiBinding.Bindings>
|
||||
<Binding ElementName="sequent5" Path="Name" />
|
||||
</MultiBinding.Bindings>
|
||||
</MultiBinding>
|
||||
</Button.CommandParameter>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<!--数据源-->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user