增加了初始弹窗,但是没有成功
更改了CAN和LIN协调 更改了配置程序的名称顺序
This commit is contained in:
@@ -2,9 +2,11 @@
|
||||
x:Class="CapMachine.Wpf.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:bar="http://www.hardcodet.net/taskbar"
|
||||
xmlns:local="clr-namespace:CapMachine.Wpf"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:prism="http://prismlibrary.com/">
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:viewmodels="clr-namespace:CapMachine.Wpf.ViewModels">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -20,6 +22,28 @@
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.LightBlue.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<!--<bar:TaskbarIcon
|
||||
x:Key="taskBar"
|
||||
DoubleClickCommand="{Binding ShowViewCommand}"
|
||||
IconSource="/Assets/Images/favicon.ico">
|
||||
<bar:TaskbarIcon.DataContext>
|
||||
<viewmodels:TaskBarViewModel />
|
||||
</bar:TaskbarIcon.DataContext>
|
||||
<bar:TaskbarIcon.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Command="{Binding ExitCommand}" Header="退出系统">
|
||||
<MenuItem.Icon>
|
||||
<Image
|
||||
Width="20"
|
||||
Height="20"
|
||||
Source="/Assets/Images/favicon.ico" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</bar:TaskbarIcon.ContextMenu>
|
||||
</bar:TaskbarIcon>-->
|
||||
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</prism:PrismApplication>
|
||||
|
||||
@@ -8,6 +8,7 @@ using CapMachine.Wpf.ViewModels;
|
||||
using CapMachine.Wpf.Views;
|
||||
using FreeSql;
|
||||
using FreeSql.Internal;
|
||||
using Hardcodet.Wpf.TaskbarNotification;
|
||||
using Prism.DryIoc;
|
||||
using Prism.Ioc;
|
||||
using Prism.Regions;
|
||||
@@ -24,6 +25,8 @@ namespace CapMachine.Wpf
|
||||
/// </summary>
|
||||
public partial class App : PrismApplication
|
||||
{
|
||||
private TaskbarIcon taskBar;
|
||||
|
||||
/// <summary>
|
||||
/// 日志服务
|
||||
/// </summary>
|
||||
@@ -38,7 +41,7 @@ namespace CapMachine.Wpf
|
||||
//24.2.7
|
||||
//Syncfusion.SfSkinManager.SfSkinManager.ApplyStylesOnApplication = true;
|
||||
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MzEyMzM3NkAzMjM0MmUzMDJlMzBHdjVKNUNpNWZxYXQwR05ZbVYvUEtzbGxXMnVxRjYvRGtLSlZUOGpjQW44PQ==");
|
||||
|
||||
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CN");
|
||||
|
||||
// 授权 a717c797-59e3-48de-b6b4-574a4e03dc79
|
||||
@@ -89,19 +92,26 @@ namespace CapMachine.Wpf
|
||||
{
|
||||
////注册日志服务
|
||||
containerRegistry.RegisterSingleton<ILogService, LogService>();
|
||||
|
||||
//注册基础的服务
|
||||
//containerRegistry.RegisterSingleton<IHostDialogService, DialogHostService>();
|
||||
//containerRegistry.RegisterSingleton<IAppStartService, AppStartService>();
|
||||
//containerRegistry.RegisterSingleton<IApplicationContext, ApplicationContext>();
|
||||
|
||||
containerRegistry.RegisterSingleton<SysRunService>();
|
||||
containerRegistry.RegisterSingleton<ConfigService>();
|
||||
|
||||
containerRegistry.RegisterSingleton<AlarmService>();
|
||||
////注册设备服务
|
||||
//containerRegistry.RegisterSingleton<MachineDataService>();
|
||||
containerRegistry.RegisterSingleton<CanDriveService>();
|
||||
containerRegistry.RegisterSingleton<LinDriveService>();
|
||||
containerRegistry.RegisterSingleton<MachineRtDataService>();
|
||||
containerRegistry.RegisterSingleton<DataRecordService>();
|
||||
containerRegistry.RegisterSingleton<HighSpeedDataService>();
|
||||
containerRegistry.RegisterSingleton<PPCService>();
|
||||
|
||||
|
||||
containerRegistry.RegisterSingleton<ComActionService>();
|
||||
|
||||
|
||||
//注册AutoMapper 将IAutoMapperProvider注入IOC容器,并对外提供IMapper注入类型。
|
||||
containerRegistry.RegisterSingleton<IMapperProvider, MapperConfig>();
|
||||
@@ -145,7 +155,9 @@ namespace CapMachine.Wpf
|
||||
containerRegistry.RegisterForNavigation<QuickMeterStepView, QuickMeterStepViewModel>();
|
||||
containerRegistry.RegisterForNavigation<HistoryDataView, HistoryDataViewModel>();
|
||||
containerRegistry.RegisterForNavigation<CANConfigView, CANConfigViewModel>();
|
||||
|
||||
containerRegistry.RegisterForNavigation<LINConfigView, LinConfigViewModel>();
|
||||
|
||||
|
||||
//注册Dialog视图时绑定VM
|
||||
containerRegistry.RegisterDialog<DialogCreateProView, DialogCreateProViewModel>();
|
||||
containerRegistry.RegisterDialog<DialogEditProView, DialogEditProViewModel>();
|
||||
@@ -162,7 +174,9 @@ namespace CapMachine.Wpf
|
||||
containerRegistry.RegisterDialog<DialogLimitConfigView, DialogLimitConfigViewModel>();
|
||||
containerRegistry.RegisterDialog<DialogSuperHeatCoolConfigView, DialogSuperHeatCoolConfigViewModel>();
|
||||
|
||||
|
||||
containerRegistry.RegisterDialog<SplashScreenView, SplashScreenViewModel>();
|
||||
|
||||
|
||||
//注册AutoMapper
|
||||
//containerRegistry.RegisterSingleton<IAutoMapperProvider, AutoMapperProvider>();
|
||||
//containerRegistry.Register(typeof(IMapper), GetMapper);
|
||||
@@ -191,6 +205,15 @@ namespace CapMachine.Wpf
|
||||
/// </summary>
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
|
||||
//初始加载资源的窗口 *******起始弹窗********
|
||||
//var appStart = ContainerLocator.Container.Resolve<IAppStartService>();
|
||||
//appStart.CreateShell();
|
||||
|
||||
|
||||
|
||||
//#region 初版
|
||||
|
||||
//Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-CN");
|
||||
|
||||
//从容器中获取MainView的实例对象
|
||||
@@ -222,8 +245,7 @@ namespace CapMachine.Wpf
|
||||
|
||||
//先加载服务,防止在ViewModel中使用时速度慢
|
||||
var appVersionService = ContainerLocator.Container.Resolve<IFreeSql>();
|
||||
//var appVersionService1 = ContainerLocator.Container.Resolve<MachineDataService>();
|
||||
//var appVersionService2 = ContainerLocator.Container.Resolve<ILogService>();
|
||||
var appVersionService2 = ContainerLocator.Container.Resolve<ILogService>();
|
||||
var appVersionService12 = ContainerLocator.Container.Resolve<AlarmService>();
|
||||
var appVersionService3 = ContainerLocator.Container.Resolve<MachineRtDataService>();
|
||||
var appVersionService4 = ContainerLocator.Container.Resolve<ProStepConfigPsView>();
|
||||
@@ -235,15 +257,21 @@ namespace CapMachine.Wpf
|
||||
var appVersionService10 = ContainerLocator.Container.Resolve<HighSpeedDataService>();
|
||||
var appVersionService11 = ContainerLocator.Container.Resolve<PPCService>();
|
||||
var appVersionService15 = ContainerLocator.Container.Resolve<ComActionService>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//给当前的全局异常捕捉服务使用
|
||||
LogService = ContainerLocator.Container.Resolve<ILogService>();
|
||||
LogService.Error("ex.ToString()");
|
||||
base.OnInitialized();
|
||||
|
||||
//#endregion
|
||||
|
||||
//*******起始弹窗 * *******
|
||||
//LogService = ContainerLocator.Container.Resolve<ILogService>();
|
||||
//LogService.Error("Start-->");
|
||||
|
||||
//base.OnInitialized();
|
||||
}
|
||||
|
||||
#region 全局异常捕捉
|
||||
@@ -258,9 +286,11 @@ namespace CapMachine.Wpf
|
||||
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
||||
}
|
||||
|
||||
|
||||
void App_Exit(object sender, ExitEventArgs e)
|
||||
{
|
||||
//程序退出时需要处理的业务
|
||||
LogService.Error("程序退出");
|
||||
}
|
||||
|
||||
|
||||
@@ -370,8 +400,26 @@ namespace CapMachine.Wpf
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// *******起始弹窗********
|
||||
///// </summary>
|
||||
//public void Initialization()
|
||||
//{
|
||||
// taskBar = (TaskbarIcon)FindResource("taskBar");
|
||||
|
||||
//}
|
||||
///// <summary>
|
||||
///// *******起始弹窗********
|
||||
///// </summary>
|
||||
//public void Dispose()
|
||||
//{
|
||||
// taskBar?.Dispose();
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BIN
CapMachine.Wpf/Assets/Images/Logo.png
Normal file
BIN
CapMachine.Wpf/Assets/Images/Logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 255 KiB |
@@ -151,6 +151,15 @@ namespace CapMachine.Wpf.CanDrive
|
||||
set { _OpenState = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private bool _DbcParserState;
|
||||
/// <summary>
|
||||
/// DBC解析的状态
|
||||
/// </summary>
|
||||
public bool DbcParserState
|
||||
{
|
||||
get { return _DbcParserState; }
|
||||
set { _DbcParserState = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫描到设备个数
|
||||
@@ -325,6 +334,7 @@ namespace CapMachine.Wpf.CanDrive
|
||||
if (DBCHandle == 0)
|
||||
{
|
||||
Console.WriteLine("Parser DBC File error!");
|
||||
DbcParserState = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -368,6 +378,9 @@ namespace CapMachine.Wpf.CanDrive
|
||||
}
|
||||
Console.WriteLine("");
|
||||
}
|
||||
|
||||
//Dbc解析成功
|
||||
DbcParserState = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -676,6 +689,7 @@ namespace CapMachine.Wpf.CanDrive
|
||||
//关闭设备
|
||||
USB_DEVICE.USB_CloseDevice(DevHandle);
|
||||
OpenState = false;
|
||||
DbcParserState = false;
|
||||
IsCycleRevice = false;
|
||||
IsCycleSend = false;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<None Remove="Assets\Fonts\iconfont.ttf" />
|
||||
<None Remove="Assets\Images\CapMachineOutput1.png" />
|
||||
<None Remove="Assets\Images\favicon.ico" />
|
||||
<None Remove="Assets\Images\Logo.png" />
|
||||
<None Remove="Assets\Images\参考工艺图.png" />
|
||||
<None Remove="PPCalculation\REFPROP\FLUIDS\13BUTADIENE.FLD" />
|
||||
<None Remove="PPCalculation\REFPROP\FLUIDS\1BUTENE.FLD" />
|
||||
@@ -180,6 +181,9 @@
|
||||
<Content Include="Assets\Images\CapMachineOutput1.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Assets\Images\Logo.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="PPCalculation\REFPROP\FLUIDS\13BUTADIENE.FLD">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@@ -666,6 +670,7 @@
|
||||
<PackageReference Include="FreeSql.Provider.Sqlite" Version="3.5.102" />
|
||||
<PackageReference Include="FreeSql.Provider.SqlServer" Version="3.5.102" />
|
||||
<PackageReference Include="FreeSql.Repository" Version="3.5.102" />
|
||||
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="2.0.1" />
|
||||
<PackageReference Include="HslCommunication" Version="12.1.2" />
|
||||
<PackageReference Include="Masuit.Tools.Core" Version="2024.5.8" />
|
||||
<PackageReference Include="MaterialDesignColors" Version="2.1.4" />
|
||||
@@ -679,6 +684,7 @@
|
||||
<PackageReference Include="Stateless" Version="5.16.0" />
|
||||
<PackageReference Include="Syncfusion.Licensing" Version="24.2.7" />
|
||||
<PackageReference Include="Syncfusion.SfGrid.WPF" Version="24.2.7" />
|
||||
<PackageReference Include="Syncfusion.SfProgressBar.WPF" Version="24.2.7" />
|
||||
<PackageReference Include="Syncfusion.Shared.WPF" Version="24.2.7" />
|
||||
<PackageReference Include="Syncfusion.Tools.WPF" Version="24.2.7" />
|
||||
<PackageReference Include="System.Collections.Concurrent" Version="4.3.0" />
|
||||
|
||||
47
CapMachine.Wpf/Dtos/LINConfigExdDto.cs
Normal file
47
CapMachine.Wpf/Dtos/LINConfigExdDto.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Dtos
|
||||
{
|
||||
public class LINConfigExdDto : BindableBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
private int _BaudRate;
|
||||
/// <summary>
|
||||
/// 波特率
|
||||
/// </summary>
|
||||
public int BaudRate
|
||||
{
|
||||
get { return _BaudRate; }
|
||||
set { _BaudRate = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private int _Cycle;
|
||||
/// <summary>
|
||||
/// 周期
|
||||
/// </summary>
|
||||
public int Cycle
|
||||
{
|
||||
get { return _Cycle; }
|
||||
set { _Cycle = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private string? _LdfPath;
|
||||
/// <summary>
|
||||
/// Ldf文件路径
|
||||
/// </summary>
|
||||
public string? LdfPath
|
||||
{
|
||||
get { return _LdfPath; }
|
||||
set { _LdfPath = value; RaisePropertyChanged(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
73
CapMachine.Wpf/LinDrive/LDFParser.cs
Normal file
73
CapMachine.Wpf/LinDrive/LDFParser.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace CapMachine.Wpf.LinDrive
|
||||
{
|
||||
/// <summary>
|
||||
/// LDF文件解析
|
||||
/// </summary>
|
||||
public class LDFParser
|
||||
{
|
||||
public const Int32 LDF_PARSER_OK = 0;//没有错误
|
||||
public const Int32 LDF_PARSER_FILE_OPEN = (-1);//打开文件出错
|
||||
public const Int32 LDF_PARSER_FILE_FORMAT = (-2);//文件格式错误
|
||||
public const Int32 LDF_PARSER_DEV_DISCONNECT = (-3);//设备未连接
|
||||
public const Int32 LDF_PARSER_HANDLE_ERROR = (-4);//LDF Handle错误
|
||||
public const Int32 LDF_PARSER_GET_INFO_ERROR = (-5);//获取解析后的数据出错
|
||||
public const Int32 LDF_PARSER_DATA_ERROR = (-6);//数据处理错误
|
||||
public const Int32 LDF_PARSER_SLAVE_NACK = (-7);//从机未响应数据
|
||||
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern UInt64 LDF_ParserFile(int DevHandle, int LINIndex, byte isMaster, StringBuilder pLDFFileName);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_GetProtocolVersion(UInt64 LDFHandle);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_GetLINSpeed(UInt64 LDFHandle);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_GetFrameQuantity(UInt64 LDFHandle);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_GetFrameName(UInt64 LDFHandle, int index, StringBuilder pFrameName);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_GetFrameSignalQuantity(UInt64 LDFHandle, StringBuilder pFrameName);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_GetFrameSignalName(UInt64 LDFHandle, StringBuilder pFrameName, int index, StringBuilder pSignalName);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_SetSignalValue(UInt64 LDFHandle, StringBuilder pFrameName, StringBuilder pSignalName, double Value);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_GetSignalValue(UInt64 LDFHandle, StringBuilder pFrameName, StringBuilder pSignalName, double[] pValue);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_GetSignalValueStr(UInt64 LDFHandle, StringBuilder pFrameName, StringBuilder pSignalName, StringBuilder pValueStr);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_SetFrameRawValue(UInt64 LDFHandle, StringBuilder pFrameName, StringBuilder pRawData);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_GetFrameRawValue(UInt64 LDFHandle, StringBuilder pFrameName, StringBuilder pRawData);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_GetFramePublisher(UInt64 LDFHandle, StringBuilder pFrameName, StringBuilder pPublisher);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_GetMasterName(UInt64 LDFHandle, StringBuilder pMasterName);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_GetSchQuantity(UInt64 LDFHandle);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_GetSchName(UInt64 LDFHandle, int index, StringBuilder pSchName);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_GetSchFrameQuantity(UInt64 LDFHandle, StringBuilder pSchName);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_GetSchFrameName(UInt64 LDFHandle, StringBuilder pSchName, int index, StringBuilder pFrameName);
|
||||
|
||||
/// <summary>
|
||||
///将帧数据发送到LIN总线,或者向从机读取数据,内部会根据主机名称和帧发布者自动判断是发送数据还是读取数据,发送数据校验模式是通过协议版本号自动判断的。
|
||||
// 若是发送数据给从机,需要先调用LDF_SetSignalValue函数设置该帧里面每个信号的值。
|
||||
//若是向从机读数据,调用该函数后,可以通过调用LDF_GetSignalValue函数获取读到的值。
|
||||
/// LDFHandle ldf文件解析句柄,通过LDF_ParserFile函数获取 。
|
||||
/// pFrameName 帧名称。
|
||||
/// </summary>
|
||||
/// <param name="LDFHandle"></param>
|
||||
/// <param name="pFrameName"></param>
|
||||
/// <param name="FillBitValue"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_ExeFrameToBus(UInt64 LDFHandle, StringBuilder pFrameName, byte FillBitValue);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LDF_ExeSchToBus(UInt64 LDFHandle, StringBuilder pSchName, byte FillBitValue);
|
||||
}
|
||||
}
|
||||
35
CapMachine.Wpf/LinDrive/LinCmdData.cs
Normal file
35
CapMachine.Wpf/LinDrive/LinCmdData.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.LinDrive
|
||||
{
|
||||
/// <summary>
|
||||
/// Lin指令数据
|
||||
/// </summary>
|
||||
public class LinCmdData
|
||||
{
|
||||
/// <summary>
|
||||
/// 配置项名称-比如转速、功率限制等
|
||||
/// </summary>
|
||||
public string? ConfigName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消息名称/Frame名称/帧名称
|
||||
/// </summary>
|
||||
public string? MsgName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 信号名称
|
||||
/// </summary>
|
||||
public string? SignalName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 指令值
|
||||
/// 没有的话,则给默认值
|
||||
/// </summary>
|
||||
public double SignalCmdValue { get; set; }
|
||||
}
|
||||
}
|
||||
93
CapMachine.Wpf/LinDrive/LinLdfModel.cs
Normal file
93
CapMachine.Wpf/LinDrive/LinLdfModel.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.LinDrive
|
||||
{
|
||||
/// <summary>
|
||||
/// LDF消息
|
||||
/// </summary>
|
||||
public class LinLdfModel : BindableBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 消息Id
|
||||
/// </summary>
|
||||
public string? MsgId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配置的中文名称:速度,转速限制,使能等常用的信息数据
|
||||
/// 但不是所有的SignalName都会配置一个Name,只是需要时才会配置名称
|
||||
/// 但是CanDbcModel集合会包括所有的SignalName名称的
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消息名称/Frame名称/帧名称
|
||||
/// </summary>
|
||||
public string? MsgName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 信号名称
|
||||
/// </summary>
|
||||
public string? SignalName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 信号描述
|
||||
/// </summary>
|
||||
public string? SignalDesc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 信号单位
|
||||
/// </summary>
|
||||
public string? SignalUnit { get; set; }
|
||||
|
||||
|
||||
private string? _SignalRtValue = "--";
|
||||
/// <summary>
|
||||
/// 信号实时值
|
||||
/// </summary>
|
||||
public string? SignalRtValue
|
||||
{
|
||||
get { return _SignalRtValue; }
|
||||
set
|
||||
{
|
||||
if (_SignalRtValue != value)
|
||||
{
|
||||
_SignalRtValue = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private StringBuilder _SignalRtValueSb = new StringBuilder(10);
|
||||
/// <summary>
|
||||
/// 信号实时值 StringBuilder
|
||||
/// </summary>
|
||||
public StringBuilder SignalRtValueSb
|
||||
{
|
||||
get { return _SignalRtValueSb; }
|
||||
set
|
||||
{
|
||||
//if (_SignalRtValueSb != value)
|
||||
//{
|
||||
SignalRtValue = value.ToString();
|
||||
_SignalRtValueSb = value;
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发布者
|
||||
/// </summary>
|
||||
public string? Publisher { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否主机帧
|
||||
/// </summary>
|
||||
public string? IsMasterFrame { get; set; }
|
||||
}
|
||||
}
|
||||
423
CapMachine.Wpf/LinDrive/ToomossLin.cs
Normal file
423
CapMachine.Wpf/LinDrive/ToomossLin.cs
Normal file
@@ -0,0 +1,423 @@
|
||||
using CapMachine.Wpf.CanDrive;
|
||||
using CapMachine.Wpf.Services;
|
||||
using Microsoft.VisualBasic;
|
||||
using Prism.Ioc;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography.Xml;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.LinDrive
|
||||
{
|
||||
/// <summary>
|
||||
/// Toomoss 的LIN驱动
|
||||
/// </summary>
|
||||
public class ToomossLin : BindableBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备Handles集合
|
||||
/// </summary>
|
||||
public Int32[] DevHandles { get; set; } = new Int32[20];
|
||||
/// <summary>
|
||||
/// 设备Handles
|
||||
/// 设备句柄,本质为设备序号的低4字节,可以通过调用USB_ScanDevice函数获得
|
||||
/// </summary>
|
||||
public Int32 DevHandle { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Lin的Index
|
||||
/// LIN通道索引号,填0或者1,若只有一个通道LIN,则填0.
|
||||
/// </summary>
|
||||
public Byte LINIndex { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Lin的连接State
|
||||
/// </summary>
|
||||
public bool state { get; set; }
|
||||
/// <summary>
|
||||
/// Lin的连接设备数量
|
||||
/// </summary>
|
||||
public Int32 DevNum { get; set; }
|
||||
/// <summary>
|
||||
/// Lin的Dll文件的路径
|
||||
/// </summary>
|
||||
public string dllFilePath { get; set; } = "USB2XXX.dll";
|
||||
|
||||
private readonly IContainerProvider ContainerProvider;
|
||||
|
||||
public ToomossLin(IContainerProvider containerProvider)
|
||||
{
|
||||
ContainerProvider = containerProvider;
|
||||
HighSpeedDataService = ContainerProvider.Resolve<HighSpeedDataService>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HighSpeedDataService 实例
|
||||
/// </summary>
|
||||
public HighSpeedDataService HighSpeedDataService { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开始LDF文件写入
|
||||
/// </summary>
|
||||
public ObservableCollection<LinLdfModel> StartLdf(string LdfPath)
|
||||
{
|
||||
LDF_Parser(LdfPath);
|
||||
return ListLinLdfModel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 开始Lin的驱动
|
||||
/// </summary>
|
||||
public void StartLinDrive()
|
||||
{
|
||||
IsExistsDllFile();
|
||||
ScanDevice();
|
||||
OpenDevice();
|
||||
|
||||
}
|
||||
|
||||
private bool _IsCycleRevice;
|
||||
/// <summary>
|
||||
/// 是否循环接收数据
|
||||
/// </summary>
|
||||
public bool IsCycleRevice
|
||||
{
|
||||
get { return _IsCycleRevice; }
|
||||
set { _IsCycleRevice = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private bool _IsCycleSend;
|
||||
/// <summary>
|
||||
/// 是否循环发送数据
|
||||
/// </summary>
|
||||
public bool IsCycleSend
|
||||
{
|
||||
get { return _IsCycleSend; }
|
||||
set { _IsCycleSend = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 循环发送数据
|
||||
/// </summary>
|
||||
public ushort SendCycle { get; set; } = 100;
|
||||
|
||||
/// <summary>
|
||||
/// 循环接受数据
|
||||
/// </summary>
|
||||
public ushort ReviceCycle { get; set; } = 500;
|
||||
|
||||
/// <summary>
|
||||
/// CycleRevice 扫描Task
|
||||
/// </summary>
|
||||
private static Task CycleReviceTask { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// CycleSend 扫描Task
|
||||
/// </summary>
|
||||
private static Task CycleSendTask { get; set; }
|
||||
|
||||
private bool _OpenState;
|
||||
/// <summary>
|
||||
/// 打开设备的状态
|
||||
/// </summary>
|
||||
public bool OpenState
|
||||
{
|
||||
get { return _OpenState; }
|
||||
set { _OpenState = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
private bool _LdfParserState;
|
||||
/// <summary>
|
||||
/// LDF解析的状态
|
||||
/// </summary>
|
||||
public bool LdfParserState
|
||||
{
|
||||
get { return _LdfParserState; }
|
||||
set { _LdfParserState = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// LDFHandle
|
||||
/// </summary>
|
||||
public UInt64 LDFHandle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// LDF消息集合
|
||||
/// 包括读取的实时值和数据
|
||||
/// </summary>
|
||||
public ObservableCollection<LinLdfModel> ListLinLdfModel { get; set; } = new ObservableCollection<LinLdfModel>();
|
||||
|
||||
/// <summary>
|
||||
/// 要发送的LIN数据
|
||||
/// </summary>
|
||||
public List<LinCmdData> CmdData { get; set; } = new List<LinCmdData>();
|
||||
|
||||
/// <summary>
|
||||
/// ******************【1】*********************
|
||||
/// 是否存在Dll文件
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsExistsDllFile()
|
||||
{
|
||||
if (!File.Exists(dllFilePath))
|
||||
{
|
||||
Console.WriteLine("请先将USB2XXX.dll和libusb-1.0.dll文件复制到exe程序文件输出目录下!");
|
||||
Console.WriteLine("dll文件在‘usb2can_lin_pwm_example/sdk/libs/windows’目录下!");
|
||||
Console.WriteLine("程序是32位的就复制‘x86’目录下文件,程序是64位的就复制‘x86_64’目录下文件!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ******************【2】*********************
|
||||
/// 扫描查找设备,并将每个设备的唯一设备号存放到数组中,后面的函数需要用到
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ScanDevice()
|
||||
{
|
||||
DevNum = USB_DEVICE.USB_ScanDevice(DevHandles);
|
||||
if (DevNum <= 0)
|
||||
{
|
||||
Console.WriteLine("No device connected!");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Have {0} device connected!", DevNum);
|
||||
DevHandle = DevHandles[0];//获取第一个设备的设备号
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ******************【3】*********************
|
||||
/// 打开设备
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool OpenDevice()
|
||||
{
|
||||
//打开设备
|
||||
OpenState = USB_DEVICE.USB_OpenDevice(DevHandle);
|
||||
if (!OpenState)
|
||||
{
|
||||
Console.WriteLine("Open device error!");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Open device success!");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ******************【4】*********************
|
||||
/// 解析LDF信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void LDF_Parser(string Path)
|
||||
{
|
||||
LDFHandle = LDFParser.LDF_ParserFile(DevHandle, LINIndex, 1, new StringBuilder(Path));
|
||||
if (LDFHandle == 0)
|
||||
{
|
||||
Console.WriteLine("解析LDF文件失败!");
|
||||
LdfParserState = false;
|
||||
return;
|
||||
}
|
||||
|
||||
//读取LDF文件信息
|
||||
Console.WriteLine("ProtocolVersion = {0}", LDFParser.LDF_GetProtocolVersion(LDFHandle));
|
||||
Console.WriteLine("LINSpeed = {0}", LDFParser.LDF_GetLINSpeed(LDFHandle));
|
||||
|
||||
//读取主机名称
|
||||
StringBuilder MasterName = new StringBuilder(64);
|
||||
LDFParser.LDF_GetMasterName(LDFHandle, MasterName);
|
||||
Console.WriteLine("Master Name = {0}", MasterName);
|
||||
|
||||
ListLinLdfModel.Clear();
|
||||
//读取信息
|
||||
int FrameLen = LDFParser.LDF_GetFrameQuantity(LDFHandle);
|
||||
for (int i = 0; i < FrameLen; i++)
|
||||
{
|
||||
//读取帧名称和发布者
|
||||
StringBuilder FrameName = new StringBuilder(64);
|
||||
string IsMasterFrame = "";
|
||||
if (LDFParser.LDF_PARSER_OK == LDFParser.LDF_GetFrameName(LDFHandle, i, FrameName))
|
||||
{
|
||||
StringBuilder PublisherName = new StringBuilder(64);
|
||||
LDFParser.LDF_GetFramePublisher(LDFHandle, FrameName, PublisherName);
|
||||
if (MasterName.Equals(PublisherName))
|
||||
{
|
||||
IsMasterFrame = "是";
|
||||
//当前帧为主机发送数据帧
|
||||
Console.WriteLine("[MW]Frame[{0}].Name={1},Publisher={2}", i, FrameName, PublisherName);
|
||||
}
|
||||
else
|
||||
{
|
||||
IsMasterFrame = "否";
|
||||
//当前帧为主机读数据帧
|
||||
Console.WriteLine("[MR]Frame[{0}].Name={1},Publisher={2}", i, FrameName, PublisherName);
|
||||
}
|
||||
|
||||
//读取信号信息
|
||||
int SignalNum = LDFParser.LDF_GetFrameSignalQuantity(LDFHandle, FrameName);
|
||||
for (int j = 0; j < SignalNum; j++)
|
||||
{
|
||||
StringBuilder SignalName = new StringBuilder(64);
|
||||
if (LDFParser.LDF_PARSER_OK == LDFParser.LDF_GetFrameSignalName(LDFHandle, FrameName, j, SignalName))
|
||||
{
|
||||
Console.WriteLine("\tSignal[{0}].Name={1}", j, SignalName);
|
||||
ListLinLdfModel.Add(new LinLdfModel()
|
||||
{
|
||||
MsgName = FrameName.ToString(),
|
||||
Publisher = PublisherName.ToString(),
|
||||
IsMasterFrame = IsMasterFrame,
|
||||
SignalName = SignalName.ToString()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//解析成功
|
||||
LdfParserState = true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送LIN数据
|
||||
/// 发送一次
|
||||
/// </summary>
|
||||
public void SendLinMsg(List<LinCmdData> CmdData)
|
||||
{
|
||||
try
|
||||
{
|
||||
//防止有多个不同的消息名称/帧,每个帧单独处理发送
|
||||
var GroupMsg = CmdData.GroupBy(x => x.MsgName);
|
||||
foreach (var itemMsg in GroupMsg)
|
||||
{
|
||||
foreach (var itemSignal in itemMsg)
|
||||
{
|
||||
//主机写操作,发送数据给从机
|
||||
LDFParser.LDF_SetSignalValue(LDFHandle, new StringBuilder(itemMsg.Key), new StringBuilder(itemSignal.SignalName), itemSignal.SignalCmdValue);
|
||||
}
|
||||
LDFParser.LDF_ExeFrameToBus(LDFHandle, new StringBuilder(itemMsg.Key), 1);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 读取信号值
|
||||
/// </summary>
|
||||
private StringBuilder ReadValueStr = new StringBuilder(64);
|
||||
|
||||
/// <summary>
|
||||
/// 循环
|
||||
/// 主机读操作,读取从机返回的数据值
|
||||
/// </summary>
|
||||
public void StartCycleReviceMsg()
|
||||
{
|
||||
CycleReviceTask = Task.Run(async () =>
|
||||
{
|
||||
while (IsCycleRevice)
|
||||
{
|
||||
await Task.Delay(ReviceCycle);
|
||||
try
|
||||
{
|
||||
//主机读操作,读取从机返回的数据值
|
||||
foreach (var item in ListLinLdfModel)
|
||||
{
|
||||
LDFParser.LDF_ExeFrameToBus(LDFHandle, new StringBuilder(item.MsgName), 1);
|
||||
LDFParser.LDF_GetSignalValueStr(LDFHandle, new StringBuilder(item.MsgName), new StringBuilder(item.SignalName), ReadValueStr);
|
||||
item.SignalRtValueSb = ReadValueStr;
|
||||
}
|
||||
|
||||
//StringBuilder ValueStr = new StringBuilder(64);
|
||||
//LDFParser.LDF_ExeFrameToBus(LDFHandle, new StringBuilder("ID_DATA"), 1);
|
||||
//LDFParser.LDF_GetSignalValueStr(LDFHandle, new StringBuilder("ID_DATA"), new StringBuilder("Supplier_ID"), ValueStr);
|
||||
//Console.WriteLine("ID_DATA.Supplier_ID={0}", ValueStr);
|
||||
//LDFParser.LDF_GetSignalValueStr(LDFHandle, new StringBuilder("ID_DATA"), new StringBuilder("Machine_ID"), ValueStr);
|
||||
//Console.WriteLine("ID_DATA.Machine_ID={0}", ValueStr);
|
||||
//LDFParser.LDF_GetSignalValueStr(LDFHandle, new StringBuilder("ID_DATA"), new StringBuilder("Chip_ID"), ValueStr);
|
||||
//Console.WriteLine("ID_DATA.Chip_ID={0}", ValueStr);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//LogService.Info($"时间:{DateTime.Now.ToString()}-【Meter】-{ex.Message}");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 循环发送数据
|
||||
/// </summary>
|
||||
public void StartCycleSendMsg()
|
||||
{
|
||||
CycleSendTask = Task.Run(async () =>
|
||||
{
|
||||
while (IsCycleSend)
|
||||
{
|
||||
await Task.Delay(SendCycle);
|
||||
try
|
||||
{
|
||||
//防止有多个不同的消息名称/帧,每个帧单独处理发送
|
||||
var GroupMsg = CmdData.GroupBy(x => x.MsgName);
|
||||
foreach (var itemMsg in GroupMsg)
|
||||
{
|
||||
foreach (var itemSignal in itemMsg)
|
||||
{
|
||||
//主机写操作,发送数据给从机
|
||||
LDFParser.LDF_SetSignalValue(LDFHandle, new StringBuilder(itemMsg.Key), new StringBuilder(itemSignal.SignalName), itemSignal.SignalCmdValue);
|
||||
}
|
||||
LDFParser.LDF_ExeFrameToBus(LDFHandle, new StringBuilder(itemMsg.Key), 1);
|
||||
}
|
||||
|
||||
////主机写操作,发送数据给从机
|
||||
//LDFParser.LDF_SetSignalValue(LDFHandle, new StringBuilder("LIN_CONTROL"), new StringBuilder("Reg_Set_Voltage"), 13.5);
|
||||
//LDFParser.LDF_SetSignalValue(LDFHandle, new StringBuilder("LIN_CONTROL"), new StringBuilder("Ramp_Time"), 3);
|
||||
//LDFParser.LDF_SetSignalValue(LDFHandle, new StringBuilder("LIN_CONTROL"), new StringBuilder("Cut_Off_Speed"), 4);
|
||||
//LDFParser.LDF_SetSignalValue(LDFHandle, new StringBuilder("LIN_CONTROL"), new StringBuilder("Exc_Limitation"), 15.6);
|
||||
//LDFParser.LDF_SetSignalValue(LDFHandle, new StringBuilder("LIN_CONTROL"), new StringBuilder("Derat_Shift"), 2);
|
||||
//LDFParser.LDF_SetSignalValue(LDFHandle, new StringBuilder("LIN_CONTROL"), new StringBuilder("MM_Request"), 2);
|
||||
//LDFParser.LDF_SetSignalValue(LDFHandle, new StringBuilder("LIN_CONTROL"), new StringBuilder("Reg_Blind"), 1);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//LogService.Info($"时间:{DateTime.Now.ToString()}-【Meter】-{ex.Message}");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 关闭设备
|
||||
/// </summary>
|
||||
public void CloseDevice()
|
||||
{
|
||||
//关闭设备
|
||||
USB_DEVICE.USB_CloseDevice(DevHandle);
|
||||
OpenState = false;
|
||||
LdfParserState = false;
|
||||
IsCycleRevice = false;
|
||||
IsCycleSend = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
106
CapMachine.Wpf/LinDrive/USB2LIN_EX.cs
Normal file
106
CapMachine.Wpf/LinDrive/USB2LIN_EX.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.LinDrive
|
||||
{
|
||||
//注意:使用这些函数需要1.5.30及以上的固件才支持
|
||||
public class USB2LIN_EX
|
||||
{
|
||||
//定义函数返回错误代码
|
||||
public const Int32 LIN_EX_SUCCESS = (0); //函数执行成功
|
||||
public const Int32 LIN_EX_ERR_NOT_SUPPORT = (-1); //适配器不支持该函数
|
||||
public const Int32 LIN_EX_ERR_USB_WRITE_FAIL = (-2); //USB写数据失败
|
||||
public const Int32 LIN_EX_ERR_USB_READ_FAIL = (-3); //USB读数据失败
|
||||
public const Int32 LIN_EX_ERR_CMD_FAIL = (-4); //命令执行失败
|
||||
public const Int32 LIN_EX_ERR_CH_NO_INIT = (-5); //该通道未初始化
|
||||
public const Int32 LIN_EX_ERR_READ_DATA = (-6); //LIN读数据失败
|
||||
//LIN和校验模式
|
||||
public const Byte LIN_EX_CHECK_STD = 0; //标准校验,不含PID
|
||||
public const Byte LIN_EX_CHECK_EXT = 1; //增强校验,包含PID
|
||||
public const Byte LIN_EX_CHECK_USER = 2; //自定义校验类型,需要用户自己计算并传入Check,不进行自动校验
|
||||
public const Byte LIN_EX_CHECK_NONE = 3; //接收数据校验错误
|
||||
public const Byte LIN_EX_CHECK_ERROR = 4; //接收数据校验错误
|
||||
//定义主从模式
|
||||
public const Byte LIN_EX_MASTER = 1;//主机
|
||||
public const Byte LIN_EX_SLAVE = 0;//从机
|
||||
|
||||
public const Byte LIN_EX_MSG_TYPE_UN = 0; //未知类型
|
||||
public const Byte LIN_EX_MSG_TYPE_MW = 1; //主机向从机发送数据
|
||||
public const Byte LIN_EX_MSG_TYPE_MR = 2; //主机从从机读取数据
|
||||
public const Byte LIN_EX_MSG_TYPE_SW = 3; //从机发送数据
|
||||
public const Byte LIN_EX_MSG_TYPE_SR = 4; //从机接收数据
|
||||
public const Byte LIN_EX_MSG_TYPE_BK = 5; //只发送BREAK信号,若是反馈回来的数据,表明只检测到BREAK信号
|
||||
public const Byte LIN_EX_MSG_TYPE_SY = 6; //表明检测到了BREAK,SYNC信号
|
||||
public const Byte LIN_EX_MSG_TYPE_ID = 7; //表明检测到了BREAK,SYNC,PID信号
|
||||
public const Byte LIN_EX_MSG_TYPE_DT = 8; //表明检测到了BREAK,SYNC,PID,DATA信号
|
||||
public const Byte LIN_EX_MSG_TYPE_CK = 9; //表明检测到了BREAK,SYNC,PID,DATA,CHECK信号
|
||||
|
||||
//LIN数据帧格式定义
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||
public struct LIN_EX_MSG
|
||||
{
|
||||
[MarshalAs(UnmanagedType.U4)]
|
||||
public UInt32 Timestamp; //时间戳
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public Byte MsgType; //帧类型
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public Byte CheckType; //校验类型
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public Byte DataLen; //LIN数据段有效数据字节数
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public Byte Sync; //固定值,0x55
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public Byte PID; //帧ID
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.U1)]
|
||||
public Byte[] Data; //数据
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public Byte Check; //校验,只有校验数据类型为LIN_EX_CHECK_USER的时候才需要用户传入数据
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public Byte BreakBits; //该帧的BRAK信号位数,有效值为10到26,若设置为其他值则默认为13位
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public Byte Reserve1;
|
||||
}
|
||||
//初始化
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LIN_EX_Init(Int32 DevHandle, Byte LINIndex, Int32 BaudRate, Byte MasterMode);
|
||||
//主机模式操作函数
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LIN_EX_MasterSync(Int32 DevHandle, Byte LINIndex, LIN_EX_MSG[] pInMsg, IntPtr pOutMsg, Int32 MsgLen);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LIN_EX_MasterBreak(Int32 DevHandle, Byte LINIndex);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LIN_EX_MasterWrite(Int32 DevHandle, Byte LINIndex, Byte PID, Byte[] pData, Byte DataLen, Byte CheckType);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LIN_EX_MasterRead(Int32 DevHandle, Byte LINIndex, Byte PID, Byte[] pData);
|
||||
//从机模式操作函数
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LIN_EX_SlaveSetIDMode(Int32 DevHandle, Byte LINIndex, LIN_EX_MSG[] pLINMsg, Int32 MsgLen);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LIN_EX_SlaveGetIDMode(Int32 DevHandle, Byte LINIndex, IntPtr pLINMsg);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LIN_EX_SlaveGetData(Int32 DevHandle, Byte LINIndex, IntPtr pLINMsg);
|
||||
//电源控制相关函数
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LIN_EX_CtrlPowerOut(Int32 DevHandle, Byte LINIndex, Byte State);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LIN_EX_GetVbatValue(Int32 DevHandle, Int16[] pBatValue);
|
||||
//主机模式自动发送数据相关函数
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LIN_EX_MasterStartSch(Int32 DevHandle, Byte LINIndex, LIN_EX_MSG[] pLINMsg, Int32 MsgLen);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LIN_EX_MasterStopSch(Int32 DevHandle, Byte LINIndex);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LIN_EX_MasterGetSch(Int32 DevHandle, Byte LINIndex, IntPtr pLINMsg);
|
||||
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LIN_EX_MasterOfflineSch(Int32 DevHandle, Byte LINIndex, Int32 BaudRate, LIN_EX_MSG[] pLINMsg, Int32 MsgLen);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LIN_EX_DecodeListFile(string pFileName, Byte CheckType, Int32 BaudRate, Byte[] pReadDataList, Byte ReadDataListLen, Byte[] pCheckTypeList, Byte CheckTypeListLen);
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 LIN_EX_GetListFileMsg(Int32 MsgIndex, Int32 MsgLen, IntPtr pLINMsg);
|
||||
}
|
||||
}
|
||||
140
CapMachine.Wpf/LinDrive/USB_DEVICE.cs
Normal file
140
CapMachine.Wpf/LinDrive/USB_DEVICE.cs
Normal file
@@ -0,0 +1,140 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.LinDrive
|
||||
{
|
||||
public class USB_DEVICE
|
||||
{
|
||||
//定义电压输出值
|
||||
public const Byte POWER_LEVEL_NONE = 0; //不输出
|
||||
public const Byte POWER_LEVEL_1V8 = 1; //输出1.8V
|
||||
public const Byte POWER_LEVEL_2V5 = 2; //输出2.5V
|
||||
public const Byte POWER_LEVEL_3V3 = 3; //输出3.3V
|
||||
public const Byte POWER_LEVEL_5V0 = 4; //输出5.0V
|
||||
//设备信息定义
|
||||
public struct DEVICE_INFO
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
public Byte[] FirmwareName; //固件名称字符串
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
public Byte[] BuildDate; //固件编译时间字符串
|
||||
public UInt32 HardwareVersion;//硬件版本号
|
||||
public UInt32 FirmwareVersion;//固件版本号
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public UInt32[] SerialNumber; //适配器序列号
|
||||
public UInt32 Functions; //适配器当前具备的功能
|
||||
}
|
||||
//方法定义
|
||||
/**
|
||||
* @brief 初始化USB设备,并扫描设备连接数,必须调用
|
||||
* @param pDevHandle 每个设备的设备号存储地址
|
||||
* @retval 扫描到的设备数量
|
||||
*/
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern Int32 USB_ScanDevice(Int32[] pDevHandle);
|
||||
/**
|
||||
* @brief 打开设备,必须调用
|
||||
* @param DevHandle 设备索引号
|
||||
* @retval 打开设备的状态
|
||||
*/
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern bool USB_OpenDevice(Int32 DevHandle);
|
||||
/**
|
||||
* @brief 关闭设备
|
||||
* @param DevHandle 设备索引号
|
||||
* @retval 关闭设备的状态
|
||||
*/
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern bool USB_CloseDevice(Int32 DevHandle);
|
||||
/**
|
||||
* @brief 复位设备程序,复位后需要重新调用USB_ScanDevice,USB_OpenDevice函数
|
||||
* @param DevHandle 设备索引号
|
||||
* @retval 复位设备的状态
|
||||
*/
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern bool USB_ResetDevice(Int32 DevHandle);
|
||||
|
||||
/**
|
||||
* @brief 检测到USB断开连接后,重新连接设备
|
||||
* @param DevHandle 设备号
|
||||
* @retval 重连状态
|
||||
*/
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern bool USB_RetryConnect(Int32 DevHandle);
|
||||
|
||||
/**
|
||||
* @brief 获取设备信息,比如设备名称,固件版本号,设备序号,设备功能说明字符串等
|
||||
* @param DevHandle 设备索引号
|
||||
* @param pDevInfo 设备信息存储结构体指针
|
||||
* @param pFunctionStr 设备功能说明字符串
|
||||
* @retval 获取设备信息的状态
|
||||
*/
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern bool DEV_GetDeviceInfo(Int32 DevHandle, ref DEVICE_INFO pDevInfo, StringBuilder pFunctionStr);
|
||||
/**
|
||||
* @brief 擦出用户区数据
|
||||
* @param DevHandle 设备索引号
|
||||
* @retval 用户区数据擦出状态
|
||||
*/
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern bool DEV_EraseUserData(Int32 DevHandle);
|
||||
|
||||
/**
|
||||
* @brief 向用户区域写入用户自定义数据,写入数据之前需要调用擦出函数将数据擦出
|
||||
* @param DevHandle 设备索引号
|
||||
* @param OffsetAddr 数据写入偏移地址,起始地址为0x00,用户区总容量为0x10000字节,也就是64KBye
|
||||
* @param pWriteData 用户数据缓冲区首地址
|
||||
* @param DataLen 待写入的数据字节数
|
||||
* @retval 写入用户自定义数据状态
|
||||
*/
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern bool DEV_WriteUserData(Int32 DevHandle, Int32 OffsetAddr, byte[] pWriteData, Int32 DataLen);
|
||||
|
||||
/**
|
||||
* @brief 从用户自定义数据区读出数据
|
||||
* @param DevHandle 设备索引号
|
||||
* @param OffsetAddr 数据写入偏移地址,起始地址为0x00,用户区总容量为0x10000字节,也就是64KBye
|
||||
* @param pReadData 用户数据缓冲区首地址
|
||||
* @param DataLen 待读出的数据字节数
|
||||
* @retval 读出用户自定义数据的状态
|
||||
*/
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern bool DEV_ReadUserData(Int32 DevHandle, Int32 OffsetAddr, byte[] pReadData, Int32 DataLen);
|
||||
|
||||
/**
|
||||
* @brief 设置可变电压输出引脚输出电压值
|
||||
* @param DevHandle 设备索引号
|
||||
* @param PowerLevel 输出电压值
|
||||
* @retval 设置输出电压状态
|
||||
*/
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern bool DEV_SetPowerLevel(Int32 DevHandle, byte PowerLevel);
|
||||
/**
|
||||
* @brief 或者CAN或者LIN的时间戳原始值
|
||||
* @param DevHandle 设备索引号
|
||||
* @param pTimestamp 时间戳指针
|
||||
* @retval 获取时间戳状态
|
||||
*/
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern bool DEV_GetTimestamp(Int32 DevHandle, byte BusType, Int32[] pTimestamp);
|
||||
|
||||
/**
|
||||
* @brief 复位CAN/LIN时间戳,需要在初始化CAN/LIN之后调用
|
||||
* @param DevHandle 设备索引号
|
||||
* @retval 复位时间戳状态
|
||||
*/
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern bool DEV_ResetTimestamp(Int32 DevHandle);
|
||||
/**
|
||||
* @brief 获取dll编译日期
|
||||
* @param pDateTime 输出DLL编译日期字符串
|
||||
* @retval 获取dll编译日期字符串
|
||||
*/
|
||||
[DllImport("USB2XXX.dll")]
|
||||
public static extern bool DEV_GetDllBuildTime(StringBuilder pDateTime);
|
||||
}
|
||||
}
|
||||
19
CapMachine.Wpf/MapperProfile/LINConfigExdProfile.cs
Normal file
19
CapMachine.Wpf/MapperProfile/LINConfigExdProfile.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using AutoMapper;
|
||||
using CapMachine.Model.CANLIN;
|
||||
using CapMachine.Wpf.Dtos;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.MapperProfile
|
||||
{
|
||||
public class LINConfigExdProfile : Profile
|
||||
{
|
||||
public LINConfigExdProfile()
|
||||
{
|
||||
CreateMap<LINConfigExd, LINConfigExdDto>().ReverseMap();
|
||||
}
|
||||
}
|
||||
}
|
||||
68
CapMachine.Wpf/Models/CanLinRunStateModel.cs
Normal file
68
CapMachine.Wpf/Models/CanLinRunStateModel.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static CapMachine.Wpf.Models.ComEnum;
|
||||
|
||||
namespace CapMachine.Wpf.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// CAN 和 LIN运行的状态汇总模型
|
||||
/// </summary>
|
||||
public class CanLinRunStateModel:BindableBase
|
||||
{
|
||||
private CanLinEnum _CurSysSelectedCanLin;
|
||||
/// <summary>
|
||||
/// 当前系统选中使用的CanLin状态
|
||||
/// </summary>
|
||||
public CanLinEnum CurSysSelectedCanLin
|
||||
{
|
||||
get { return _CurSysSelectedCanLin; }
|
||||
set
|
||||
{
|
||||
_CurSysSelectedCanLin = value;
|
||||
switch (value)
|
||||
{
|
||||
case CanLinEnum.No:
|
||||
SelectedCanLinMsg = "无";
|
||||
CanLinRunState = false;
|
||||
break;
|
||||
case CanLinEnum.Can:
|
||||
SelectedCanLinMsg = "CAN";
|
||||
CanLinRunState=true;
|
||||
break;
|
||||
case CanLinEnum.Lin:
|
||||
SelectedCanLinMsg = "LIN";
|
||||
CanLinRunState = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool _CanLinRunState;
|
||||
/// <summary>
|
||||
/// CAN 和 LIN的运行状态
|
||||
/// </summary>
|
||||
public bool CanLinRunState
|
||||
{
|
||||
get { return _CanLinRunState; }
|
||||
set { _CanLinRunState = value;RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
private string? _SelectedCanLinMsg;
|
||||
/// <summary>
|
||||
/// CANLIN 选择的字符串
|
||||
/// </summary>
|
||||
public string? SelectedCanLinMsg
|
||||
{
|
||||
get { return _SelectedCanLinMsg; }
|
||||
set { _SelectedCanLinMsg = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -54,5 +54,26 @@ namespace CapMachine.Wpf.Models
|
||||
/// </summary>
|
||||
Byte = 0,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CAN和LIN的选择
|
||||
/// </summary>
|
||||
public enum CanLinEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 没选择
|
||||
/// </summary>
|
||||
No = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Can
|
||||
/// </summary>
|
||||
Can = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Lin
|
||||
/// </summary>
|
||||
Lin = 2,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
65
CapMachine.Wpf/Models/SysExdInfo.cs
Normal file
65
CapMachine.Wpf/Models/SysExdInfo.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using CapMachine.Wpf.Models.Tag;
|
||||
using HslCommunication.Profinet.Siemens;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统拓展信息
|
||||
/// 包括:运行时间,步骤等PLC等其他信息,不在实时数据集合中的其他信息
|
||||
/// </summary>
|
||||
public class SysExdInfo:BindableBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
public SysExdInfo(SiemensS7Net siemensS7Net)
|
||||
{
|
||||
QuickTags = new List<QuickTag>()
|
||||
{
|
||||
new QuickTag(siemensS7Net){ Name="RunTime-Sec",Group="时间",Unit="秒",ValueAddress="VW190",Precision=0,ValueType=ComEnum.DataType.Short,ByteLength=2},
|
||||
new QuickTag(siemensS7Net){ Name="RunTime-Min",Group="时间",Unit="分",ValueAddress="VW192",Precision=0,ValueType=ComEnum.DataType.Short,ByteLength=2},
|
||||
new QuickTag(siemensS7Net){ Name="RunTime-Hour",Group="时间",Unit="时",ValueAddress="VW194",Precision=0,ValueType=ComEnum.DataType.Short,ByteLength=2},
|
||||
};
|
||||
|
||||
|
||||
RunTimeSecQuickTag= QuickTags.Find(x => x.Name == "RunTime-Sec")!;
|
||||
RunTimeMinQuickTag = QuickTags.Find(x => x.Name == "RunTime-Min")!;
|
||||
RunTimeHourQuickTag = QuickTags.Find(x => x.Name == "RunTime-Hour")!;
|
||||
}
|
||||
|
||||
private QuickTag RunTimeSecQuickTag { get; set; }
|
||||
private QuickTag RunTimeMinQuickTag { get; set; }
|
||||
private QuickTag RunTimeHourQuickTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 快速标签
|
||||
/// </summary>
|
||||
public List<QuickTag> QuickTags { get; set; }
|
||||
|
||||
private string _RunTimeMsg;
|
||||
/// <summary>
|
||||
/// 运行时间消息
|
||||
/// </summary>
|
||||
public string RunTimeMsg
|
||||
{
|
||||
get { return _RunTimeMsg; }
|
||||
set { _RunTimeMsg = value;RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 合并运行时间
|
||||
/// </summary>
|
||||
public void SumRunTime()
|
||||
{
|
||||
RunTimeMsg= RunTimeHourQuickTag.ValueStr + "时" + RunTimeMinQuickTag.ValueStr + "分" + RunTimeSecQuickTag.ValueStr + "秒";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
147
CapMachine.Wpf/Models/Tag/QuickTag.cs
Normal file
147
CapMachine.Wpf/Models/Tag/QuickTag.cs
Normal file
@@ -0,0 +1,147 @@
|
||||
using HslCommunication;
|
||||
using HslCommunication.Core;
|
||||
using HslCommunication.Core.Device;
|
||||
using HslCommunication.Profinet.Siemens;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static CapMachine.Wpf.Models.ComEnum;
|
||||
|
||||
namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
/// <summary>
|
||||
/// 快速和简单的标签
|
||||
/// </summary>
|
||||
public class QuickTag : BindableBase
|
||||
{
|
||||
public QuickTag(SiemensS7Net deviceTcpNet)
|
||||
{
|
||||
|
||||
SiemensS7Net = deviceTcpNet;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 驱动
|
||||
/// </summary>
|
||||
public SiemensS7Net SiemensS7Net { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标签组
|
||||
/// </summary>
|
||||
public string? Group { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 实时值
|
||||
///// </summary>
|
||||
//public abstract IRegisterValue<short> RtValue { get; set; }
|
||||
|
||||
private object? _Value;
|
||||
/// <summary>
|
||||
/// 实时值
|
||||
/// </summary>
|
||||
public object? Value
|
||||
{
|
||||
get { return _Value; }
|
||||
set
|
||||
{
|
||||
_Value = value;
|
||||
ValueStr = value?.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private OperateResult<byte[]>? _OperateResultSource;
|
||||
/// <summary>
|
||||
/// 原始值实时值
|
||||
/// </summary>
|
||||
public OperateResult<byte[]>? OperateResultSource
|
||||
{
|
||||
get { return _OperateResultSource; }
|
||||
set
|
||||
{
|
||||
switch (ValueType)
|
||||
{
|
||||
case DataType.Short:
|
||||
Value = SiemensS7Net.ByteTransform.TransInt16(value!.Content, 0);
|
||||
break;
|
||||
case DataType.Double:
|
||||
Value = SiemensS7Net.ByteTransform.TransDouble(value!.Content, 0);
|
||||
break;
|
||||
case DataType.String:
|
||||
Value = SiemensS7Net.ByteTransform.TransString(value!.Content, Encoding.ASCII);
|
||||
break;
|
||||
case DataType.Byte:
|
||||
Value = SiemensS7Net.ByteTransform.TransByte(value!.Content, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
_OperateResultSource = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据类型信息
|
||||
/// </summary>
|
||||
public DataType ValueType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 值地址信息
|
||||
/// </summary>
|
||||
public string? ValueAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地址信息 Index
|
||||
/// </summary>
|
||||
public int Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字节长度
|
||||
/// </summary>
|
||||
public ushort ByteLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大值
|
||||
/// </summary>
|
||||
public double MaxValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最小值
|
||||
/// </summary>
|
||||
public double MinValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 精度 到PLC的转换精度/分辨率
|
||||
/// </summary>
|
||||
public short Precision { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 小数点 展示时用的小数点
|
||||
/// </summary>
|
||||
public short DecimalPoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string? Unit { get; set; }
|
||||
|
||||
private string? _ValueStr;
|
||||
/// <summary>
|
||||
/// 值的字符串
|
||||
/// </summary>
|
||||
public string? ValueStr
|
||||
{
|
||||
get { return _ValueStr; }
|
||||
set { _ValueStr = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
160
CapMachine.Wpf/Services/AppStartService.cs
Normal file
160
CapMachine.Wpf/Services/AppStartService.cs
Normal file
@@ -0,0 +1,160 @@
|
||||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using Syncfusion.Windows.Shared;
|
||||
using Prism.Ioc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using CapMachine.Wpf.Views;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// App启动服务
|
||||
/// 暂时不用
|
||||
/// </summary>
|
||||
public class AppStartService:IAppStartService
|
||||
{
|
||||
/// <summary>
|
||||
/// 退出
|
||||
/// </summary>
|
||||
public void Exit()
|
||||
{
|
||||
if (System.Windows.Application.Current is IAppTaskBar appTaskBar)
|
||||
appTaskBar.Dispose();
|
||||
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录退出
|
||||
/// </summary>
|
||||
public void Logout()
|
||||
{
|
||||
App.Current.MainWindow.Hide();
|
||||
SplashScreenInitialized();
|
||||
App.Current.MainWindow.Show();
|
||||
|
||||
if (App.Current.MainWindow.DataContext is INavigationAware navigationAware)
|
||||
navigationAware.OnNavigatedTo(null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CreateShell
|
||||
/// </summary>
|
||||
public void CreateShell()
|
||||
{
|
||||
var container = ContainerLocator.Container;
|
||||
|
||||
//var userConfigurationService = container.Resolve<UserConfigurationService>();
|
||||
//userConfigurationService.OnAccessTokenRefresh = OnAccessTokenRefresh;
|
||||
//userConfigurationService.OnSessionTimeOut = OnSessionTimeout;
|
||||
|
||||
//初始的窗户
|
||||
SplashScreenInitialized();
|
||||
|
||||
#region 初版
|
||||
|
||||
//Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-CN");
|
||||
|
||||
//从容器中获取MainView的实例对象,系统运行的主窗体
|
||||
//var container = ContainerLocator.Container;
|
||||
var shell = container.Resolve<object>("MainView");
|
||||
|
||||
//加载种子数据
|
||||
//var SeekData = new SeekData(container.Resolve<IFreeSql>());
|
||||
|
||||
if (shell is Window view)
|
||||
{
|
||||
//更新Prism注册区域信息
|
||||
var regionManager = container.Resolve<IRegionManager>();
|
||||
RegionManager.SetRegionManager(view, regionManager);
|
||||
RegionManager.UpdateRegions();
|
||||
|
||||
//给MainView的MainViewFooterContentRegion区域设置FooterView具体的信息
|
||||
regionManager.RequestNavigate("MainViewFooterContentRegion", nameof(FooterView));
|
||||
regionManager.RequestNavigate("MainViewContentRegion", nameof(MonitorView));
|
||||
|
||||
//调用首页的INavigationAware 接口做一个初始化操作
|
||||
if (view.DataContext is INavigationAware navigationAware)
|
||||
{
|
||||
navigationAware.OnNavigatedTo(null);
|
||||
//呈现首页
|
||||
App.Current.MainWindow = view;
|
||||
}
|
||||
}
|
||||
|
||||
//先加载服务,防止在ViewModel中使用时速度慢
|
||||
var appVersionService = ContainerLocator.Container.Resolve<IFreeSql>();
|
||||
//var appVersionService1 = ContainerLocator.Container.Resolve<MachineDataService>();
|
||||
//var appVersionService2 = ContainerLocator.Container.Resolve<ILogService>();
|
||||
var appVersionService12 = ContainerLocator.Container.Resolve<AlarmService>();
|
||||
var appVersionService3 = ContainerLocator.Container.Resolve<MachineRtDataService>();
|
||||
var appVersionService4 = ContainerLocator.Container.Resolve<ProStepConfigPsView>();
|
||||
var appVersionService5 = ContainerLocator.Container.Resolve<ProConfigView>();
|
||||
var appVersionService6 = ContainerLocator.Container.Resolve<HistoryDataView>();
|
||||
var appVersionService7 = ContainerLocator.Container.Resolve<RealTimeChartView>();
|
||||
var appVersionService8 = ContainerLocator.Container.Resolve<CanDriveService>();
|
||||
var appVersionService9 = ContainerLocator.Container.Resolve<DataRecordService>();
|
||||
var appVersionService10 = ContainerLocator.Container.Resolve<HighSpeedDataService>();
|
||||
var appVersionService11 = ContainerLocator.Container.Resolve<PPCService>();
|
||||
var appVersionService15 = ContainerLocator.Container.Resolve<ComActionService>();
|
||||
|
||||
|
||||
|
||||
//给当前的全局异常捕捉服务使用
|
||||
//LogService = ContainerLocator.Container.Resolve<ILogService>();
|
||||
//LogService.Error("ex.ToString()");
|
||||
//base.OnInitialized();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
//var shell = container.Resolve<object>("MainView");
|
||||
//if (shell is ChromelessWindow view)
|
||||
//{
|
||||
// var regionManager = container.Resolve<IRegionManager>();
|
||||
// RegionManager.SetRegionManager(view, regionManager);
|
||||
// RegionManager.UpdateRegions();
|
||||
|
||||
// if (view.DataContext is INavigationAware navigationAware)
|
||||
// {
|
||||
// navigationAware.OnNavigatedTo(null);
|
||||
// App.Current.MainWindow = (Window)shell;
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
private void SplashScreenInitialized()
|
||||
{
|
||||
var dialogService = ContainerLocator.Container.Resolve<IHostDialogService>();
|
||||
var result = dialogService.ShowWindow("SplashScreenView").Result;
|
||||
|
||||
if (result == ButtonResult.Ignore)
|
||||
{
|
||||
if (!Authorization()) Exit();
|
||||
}
|
||||
else if (result == ButtonResult.No) Exit();
|
||||
}
|
||||
|
||||
private bool Authorization()
|
||||
{
|
||||
var validationResult = Validation();
|
||||
if (validationResult == ButtonResult.Retry)
|
||||
return Authorization();
|
||||
|
||||
return validationResult == ButtonResult.OK;
|
||||
|
||||
static ButtonResult Validation()
|
||||
{
|
||||
var dialogService = ContainerLocator.Container.Resolve<IHostDialogService>();
|
||||
return dialogService.ShowWindow("MainView").Result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
16
CapMachine.Wpf/Services/ApplicationContext.cs
Normal file
16
CapMachine.Wpf/Services/ApplicationContext.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用程序上下文,语言,多租户,登录等信息
|
||||
/// </summary>
|
||||
public class ApplicationContext: IApplicationContext
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -249,7 +249,25 @@ namespace CapMachine.Wpf.Services
|
||||
return double.TryParse(ListCanDbcModel.FindFirst(a => a.Name == Name).SignalRtValue.Split(" ")[0], out double Result) == true ? Result : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 速度的数据的获取
|
||||
/// 获取速度数据值
|
||||
/// 从DBC中获取Speed数据给数据中心集合
|
||||
/// </summary>
|
||||
/// <param name="Name"></param>
|
||||
/// <returns></returns>
|
||||
public double GetDbcSpeedValueBySpeedName(string Name)
|
||||
{
|
||||
if (!ToomossCanDrive.IsCycleRevice) return 0;
|
||||
|
||||
if (ListCanDbcModel.Any(a => a.Name == Name))
|
||||
{
|
||||
//double.TryParse(ListCanDbcModel.FindFirst(a => a.Name == Name).SignalRtValue, out double Result1);
|
||||
return double.TryParse(ListCanDbcModel.FindFirst(a => a.Name == Name).SignalRtValue.Split(" ")[0], out double Result) == true ? Result : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 公共操作的服务
|
||||
/// 存放公共事件的服务
|
||||
@@ -22,12 +22,14 @@ namespace CapMachine.Wpf.Services
|
||||
public DataRecordService DataRecordService { get; }
|
||||
public SysRunService SysRunServer { get; }
|
||||
public PPCService PPCService { get; }
|
||||
public CanDriveService CanDriveService { get; }
|
||||
public LinDriveService LinDriveService { get; }
|
||||
public MachineRtDataService MachineRtDataService { get; }
|
||||
public IDialogService DialogService { get; }
|
||||
|
||||
|
||||
public ComActionService(ConfigService configService, IEventAggregator eventAggregator,
|
||||
DataRecordService dataRecordService, SysRunService sysRunService,PPCService pPCService,
|
||||
DataRecordService dataRecordService, SysRunService sysRunService, PPCService pPCService, CanDriveService canDriveService, LinDriveService linDriveService,
|
||||
MachineRtDataService machineRtDataService, IDialogService dialogService)
|
||||
{
|
||||
ConfigService = configService;
|
||||
@@ -36,6 +38,8 @@ namespace CapMachine.Wpf.Services
|
||||
DataRecordService = dataRecordService;
|
||||
SysRunServer = sysRunService;
|
||||
PPCService = pPCService;
|
||||
CanDriveService = canDriveService;
|
||||
LinDriveService = linDriveService;
|
||||
MachineRtDataService = machineRtDataService;
|
||||
DialogService = dialogService;
|
||||
|
||||
@@ -43,7 +47,6 @@ namespace CapMachine.Wpf.Services
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 公共弹窗操作
|
||||
|
||||
/// <summary>
|
||||
@@ -90,6 +93,42 @@ namespace CapMachine.Wpf.Services
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region CAN和LIN协调
|
||||
|
||||
//CAN和LIN同一个时刻只能有一个在工作
|
||||
|
||||
/// <summary>
|
||||
/// CAN是否可以工作
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsCanToDoWork()
|
||||
{
|
||||
if (LinDriveService.ToomossLinDrive.OpenState == true)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// LIN是否可以工作
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsLINToDoWork()
|
||||
{
|
||||
if (CanDriveService.ToomossCanDrive.OpenState == true)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
using CapMachine.Model;
|
||||
using CapMachine.Model.CANLIN;
|
||||
using CapMachine.Wpf.Dtos;
|
||||
using CapMachine.Wpf.Models;
|
||||
using CapMachine.Wpf.PrismEvent;
|
||||
using Prism.Events;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Services.Dialogs;
|
||||
using static CapMachine.Wpf.Models.ComEnum;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
@@ -18,10 +21,10 @@ namespace CapMachine.Wpf.Services
|
||||
CurUserDto = new UserDto();
|
||||
|
||||
EventAggregator = eventAggregator;
|
||||
|
||||
|
||||
DialogService = dialogService;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Csv文件锁
|
||||
@@ -65,6 +68,31 @@ namespace CapMachine.Wpf.Services
|
||||
/// </summary>
|
||||
public int ChartRtDataCacheTimeSec { get; set; } = 3600_8;
|
||||
|
||||
/// <summary>
|
||||
/// CAN和LIN的运行状态模型
|
||||
/// </summary>
|
||||
public CanLinRunStateModel CanLinRunStateModel { get; set; } = new CanLinRunStateModel();
|
||||
|
||||
|
||||
private int _PlcCycleTime;
|
||||
/// <summary>
|
||||
/// PLC循环时间
|
||||
/// </summary>
|
||||
public int PlcCycleTime
|
||||
{
|
||||
get { return _PlcCycleTime; }
|
||||
set
|
||||
{
|
||||
if (value!= _PlcCycleTime)
|
||||
{
|
||||
_PlcCycleTime = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private HistoryExp _CurExpInfo;
|
||||
/// <summary>
|
||||
@@ -109,7 +137,7 @@ namespace CapMachine.Wpf.Services
|
||||
public PPCService PPCService { get; }
|
||||
public IDialogService DialogService { get; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
75
CapMachine.Wpf/Services/DialogExtensions.cs
Normal file
75
CapMachine.Wpf/Services/DialogExtensions.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 会话窗口扩展服务
|
||||
/// </summary>
|
||||
public static class DialogExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 询问窗口
|
||||
/// </summary>
|
||||
/// <param name="hostDialogService"></param>
|
||||
/// <param name="message">提示消息</param>
|
||||
/// <param name="IdentifierName">会话ID</param>
|
||||
/// <returns></returns>
|
||||
public static async Task<bool> Question(this IHostDialogService hostDialogService,
|
||||
string message,
|
||||
string IdentifierName)
|
||||
{
|
||||
return await Question(hostDialogService, "确定", message, IdentifierName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 询问窗口-指定标题
|
||||
/// </summary>
|
||||
/// <param name="hostDialogService"></param>
|
||||
/// <param name="title">标题</param>
|
||||
/// <param name="message">提示消息</param>
|
||||
/// <param name="IdentifierName">会话ID</param>
|
||||
/// <returns></returns>
|
||||
public static async Task<bool> Question(this IHostDialogService hostDialogService,
|
||||
string title,
|
||||
string message,
|
||||
string IdentifierName)
|
||||
{
|
||||
DialogParameters param = new DialogParameters();
|
||||
param.Add("Title", title);
|
||||
param.Add("Message", message);
|
||||
|
||||
var dialogResult = await hostDialogService.ShowDialogAsync("AppViews.HostMessageBox", param, IdentifierName);
|
||||
|
||||
return dialogResult.Result == ButtonResult.OK;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 询问窗口
|
||||
/// </summary>
|
||||
/// <param name="dialogService"></param>
|
||||
/// <param name="title">标题</param>
|
||||
/// <param name="message">提示消息</param>
|
||||
/// <returns></returns>
|
||||
public static bool Question(this IDialogService dialogService, string title, string message)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(title))
|
||||
title = "确定";
|
||||
|
||||
DialogParameters parameters = new DialogParameters();
|
||||
parameters.Add("Title", title);
|
||||
parameters.Add("Message", message);
|
||||
|
||||
bool dialogResult = false;
|
||||
dialogService.ShowDialog("AppViews.MessageBox", parameters, callback =>
|
||||
{
|
||||
dialogResult = callback.Result == ButtonResult.OK;
|
||||
});
|
||||
return dialogResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
108
CapMachine.Wpf/Services/DialogHostService.cs
Normal file
108
CapMachine.Wpf/Services/DialogHostService.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Prism.Common;
|
||||
using Prism.Ioc;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 对话主机服务
|
||||
/// </summary>
|
||||
public class DialogHostService : DialogService, IHostDialogService
|
||||
{
|
||||
private readonly IContainerExtension _containerExtension;
|
||||
|
||||
public DialogHostService(IContainerExtension containerExtension) : base(containerExtension)
|
||||
{
|
||||
_containerExtension = containerExtension;
|
||||
}
|
||||
|
||||
public IDialogResult ShowWindow(string name)
|
||||
{
|
||||
IDialogResult dialogResult = new DialogResult(ButtonResult.None);
|
||||
|
||||
var content = _containerExtension.Resolve<object>(name);
|
||||
|
||||
if (!(content is Window dialogContent))
|
||||
throw new NullReferenceException("A dialog's content must be a Window");
|
||||
|
||||
if (dialogContent is Window view && view.DataContext is null && ViewModelLocator.GetAutoWireViewModel(view) is null)
|
||||
ViewModelLocator.SetAutoWireViewModel(view, true);
|
||||
|
||||
if (!(dialogContent.DataContext is IDialogAware viewModel))
|
||||
throw new NullReferenceException("A dialog's ViewModel must implement the IDialogAware interface");
|
||||
|
||||
if (dialogContent is IDialogWindow dialogWindow)
|
||||
{
|
||||
ConfigureDialogWindowEvents(dialogWindow, result => { dialogResult = result; });
|
||||
}
|
||||
|
||||
MvvmHelpers.ViewAndViewModelAction<IDialogAware>(viewModel, d => d.OnDialogOpened(null));
|
||||
dialogContent.ShowDialog();
|
||||
return dialogResult;
|
||||
}
|
||||
|
||||
public async Task<IDialogResult> ShowDialogAsync(string name, IDialogParameters parameters = null, string IdentifierName = "Root")
|
||||
{
|
||||
var dialogContent = GetDialogContent(name, IdentifierName);
|
||||
|
||||
if (!(dialogContent.DataContext is IHostDialogAware viewModel))
|
||||
throw new NullReferenceException("A dialog's ViewModel must implement the IDialogHostAware interface");
|
||||
|
||||
var eventHandler = GetDialogOpenedEventHandler(viewModel, parameters);
|
||||
|
||||
var dialogResult = await DialogHost.Show(dialogContent, IdentifierName, eventHandler);
|
||||
|
||||
if (dialogResult == null)
|
||||
return new DialogResult(ButtonResult.Cancel);
|
||||
|
||||
return (IDialogResult)dialogResult;
|
||||
}
|
||||
|
||||
private FrameworkElement GetDialogContent(string name, string IdentifierName = "Root")
|
||||
{
|
||||
var content = _containerExtension.Resolve<object>(name);
|
||||
if (!(content is FrameworkElement dialogContent))
|
||||
throw new NullReferenceException("A dialog's content must be a FrameworkElement");
|
||||
|
||||
if (dialogContent is FrameworkElement view && view.DataContext is null && ViewModelLocator.GetAutoWireViewModel(view) is null)
|
||||
ViewModelLocator.SetAutoWireViewModel(view, true);
|
||||
|
||||
if (!(dialogContent.DataContext is IHostDialogAware viewModel))
|
||||
throw new NullReferenceException("A dialog's ViewModel must implement the IDialogHostAware interface");
|
||||
|
||||
viewModel.IdentifierName = IdentifierName;
|
||||
|
||||
return dialogContent;
|
||||
}
|
||||
|
||||
private DialogOpenedEventHandler GetDialogOpenedEventHandler(IHostDialogAware viewModel,
|
||||
IDialogParameters parameters)
|
||||
{
|
||||
if (parameters == null) parameters = new DialogParameters();
|
||||
|
||||
DialogOpenedEventHandler eventHandler =
|
||||
(sender, eventArgs) =>
|
||||
{
|
||||
var _content = eventArgs.Session.Content;
|
||||
if (viewModel is IHostDialogAware aware)
|
||||
aware.OnDialogOpened(parameters);
|
||||
eventArgs.Session.UpdateContent(_content);
|
||||
};
|
||||
|
||||
return eventHandler;
|
||||
}
|
||||
|
||||
public void Close(string IdentifierName, DialogResult dialogResult)
|
||||
{
|
||||
DialogHost.Close(IdentifierName, dialogResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
20
CapMachine.Wpf/Services/IAppStartService.cs
Normal file
20
CapMachine.Wpf/Services/IAppStartService.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// App启动服务接口
|
||||
/// </summary>
|
||||
public interface IAppStartService
|
||||
{
|
||||
void CreateShell();
|
||||
|
||||
void Logout();
|
||||
|
||||
void Exit();
|
||||
}
|
||||
}
|
||||
15
CapMachine.Wpf/Services/IAppTaskBar.cs
Normal file
15
CapMachine.Wpf/Services/IAppTaskBar.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
public interface IAppTaskBar
|
||||
{
|
||||
void Initialization();
|
||||
|
||||
void Dispose();
|
||||
}
|
||||
}
|
||||
31
CapMachine.Wpf/Services/IApplicationContext.cs
Normal file
31
CapMachine.Wpf/Services/IApplicationContext.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
public interface IApplicationContext
|
||||
{
|
||||
//[CanBeNull]
|
||||
//TenantInformation CurrentTenant { get; }
|
||||
|
||||
//AbpUserConfigurationDto Configuration { get; set; }
|
||||
|
||||
//GetCurrentLoginInformationsOutput LoginInfo { get; }
|
||||
|
||||
//void ClearLoginInfo();
|
||||
|
||||
//void SetLoginInfo(GetCurrentLoginInformationsOutput loginInfo);
|
||||
|
||||
//void SetAsHost();
|
||||
|
||||
//void SetAsTenant(string tenancyName, int tenantId);
|
||||
|
||||
//LanguageInfo CurrentLanguage { get; set; }
|
||||
|
||||
//void Load(TenantInformation currentTenant, GetCurrentLoginInformationsOutput loginInfo);
|
||||
}
|
||||
}
|
||||
37
CapMachine.Wpf/Services/IHostDialogAware.cs
Normal file
37
CapMachine.Wpf/Services/IHostDialogAware.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 对话主机ViewModel基类
|
||||
/// </summary>
|
||||
public interface IHostDialogAware
|
||||
{
|
||||
/// <summary>
|
||||
/// DialogHost顶级节点
|
||||
/// </summary>
|
||||
string IdentifierName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 页面初始化前传递参数事件
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
/// <returns></returns>
|
||||
void OnDialogOpened(IDialogParameters parameters);
|
||||
|
||||
/// <summary>
|
||||
/// 确认
|
||||
/// </summary>
|
||||
Task Save();
|
||||
|
||||
/// <summary>
|
||||
/// 取消
|
||||
/// </summary>
|
||||
void Cancel();
|
||||
}
|
||||
}
|
||||
31
CapMachine.Wpf/Services/IHostDialogService.cs
Normal file
31
CapMachine.Wpf/Services/IHostDialogService.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 对话主机服务接口
|
||||
/// </summary>
|
||||
public interface IHostDialogService : IDialogService
|
||||
{
|
||||
/// <summary>
|
||||
/// 显示Dialog
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="parameters"></param>
|
||||
/// <param name="IdentifierName"></param>
|
||||
/// <returns></returns>
|
||||
Task<IDialogResult> ShowDialogAsync(
|
||||
string name,
|
||||
IDialogParameters parameters = null,
|
||||
string IdentifierName = "Root");
|
||||
|
||||
IDialogResult ShowWindow(string name);
|
||||
|
||||
void Close(string IdentifierName, DialogResult dialogResult);
|
||||
}
|
||||
}
|
||||
273
CapMachine.Wpf/Services/LinDriveService.cs
Normal file
273
CapMachine.Wpf/Services/LinDriveService.cs
Normal file
@@ -0,0 +1,273 @@
|
||||
using CapMachine.Model.CANLIN;
|
||||
using CapMachine.Wpf.LinDrive;
|
||||
using ImTools;
|
||||
using Prism.Ioc;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Lin驱动服务
|
||||
/// </summary>
|
||||
public class LinDriveService : BindableBase
|
||||
{
|
||||
public HighSpeedDataService HighSpeedDataService { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
public LinDriveService(HighSpeedDataService highSpeedDataService, IContainerProvider containerProvider)
|
||||
{
|
||||
ToomossLinDrive = new ToomossLin(containerProvider);
|
||||
//高速数据服务
|
||||
HighSpeedDataService = highSpeedDataService;
|
||||
|
||||
//ToomossLinDrive.StartLinDrive();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前选中的CanLinConfigPro 程序
|
||||
/// </summary>
|
||||
public CanLinConfigPro SelectedCanLinConfigPro { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 图莫斯 CAN Drive
|
||||
/// ToomossLinDrive
|
||||
/// </summary>
|
||||
public ToomossLin ToomossLinDrive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ldf消息集合
|
||||
/// 包括读取的实时值和数据
|
||||
/// </summary>
|
||||
public ObservableCollection<LinLdfModel> ListLinLdfModel { get; set; } = new ObservableCollection<LinLdfModel>();
|
||||
|
||||
/// <summary>
|
||||
/// 初始化CAN的配置信息
|
||||
/// </summary>
|
||||
public void InitLinConfig(CanLinConfigPro selectedLinLinConfigPro)
|
||||
{
|
||||
//赋值配置数据
|
||||
SelectedCanLinConfigPro = selectedLinLinConfigPro;
|
||||
//为DBC实时数据关联配置的名称
|
||||
foreach (var item in SelectedCanLinConfigPro.CanLinConfigContents)
|
||||
{
|
||||
var FindData = ListLinLdfModel.FindFirst(a => a.SignalName == item.SignalName);
|
||||
if (FindData != null)
|
||||
{
|
||||
FindData.Name = item.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 开始DBC 配置文件 加载
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ObservableCollection<LinLdfModel> StartLdf(string Path)
|
||||
{
|
||||
ListLinLdfModel = ToomossLinDrive.StartLdf(Path);
|
||||
return ListLinLdfModel;
|
||||
}
|
||||
|
||||
|
||||
#region 程序驱动CAN
|
||||
|
||||
/// <summary>
|
||||
/// 转速 指令数据 实例
|
||||
/// </summary>
|
||||
private LinCmdData SpeedLinCmdData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 功率限制 指令数据 实例
|
||||
/// </summary>
|
||||
private LinCmdData PwLimitLinCmdData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 使能 指令数据 实例
|
||||
/// </summary>
|
||||
private LinCmdData EnableLinCmdData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 要发送的CAN指令数据
|
||||
/// 在程序配置好后就确定要发送哪些数据
|
||||
/// </summary>
|
||||
public List<LinCmdData> CmdData { get; set; } = new List<LinCmdData>();
|
||||
|
||||
/// <summary>
|
||||
/// 增加发送的指令数据
|
||||
/// </summary>
|
||||
/// <param name="canCmdData"></param>
|
||||
public void AddCmdData(LinCmdData SendLinCmdData)
|
||||
{
|
||||
//提取常用的实例数据
|
||||
switch (SendLinCmdData.ConfigName)
|
||||
{
|
||||
case "转速":
|
||||
SpeedLinCmdData = SendLinCmdData;
|
||||
break;
|
||||
case "功率限制":
|
||||
PwLimitLinCmdData = SendLinCmdData;
|
||||
break;
|
||||
case "使能":
|
||||
EnableLinCmdData = SendLinCmdData;
|
||||
break;
|
||||
case "Anti_Sleep":
|
||||
//SpeedLinCmdData = SendLinCmdData;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//添加到发送数据集合
|
||||
CmdData.Add(SendLinCmdData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 更新速度信息
|
||||
/// 默认是启动
|
||||
/// </summary>
|
||||
/// <param name="canCmdData"></param>
|
||||
public void UpdateSpeedCmdData(double SpeedData)
|
||||
{
|
||||
if (SpeedLinCmdData != null)
|
||||
{
|
||||
SpeedLinCmdData.SignalCmdValue = SpeedData;
|
||||
}
|
||||
if (EnableLinCmdData != null)
|
||||
{
|
||||
EnableLinCmdData.SignalCmdValue = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送消息给CAN 驱动
|
||||
/// </summary>
|
||||
public void SendMsgToLinDrive(double SpeedData)
|
||||
{
|
||||
if (ToomossLinDrive.OpenState)
|
||||
{
|
||||
if (CmdData.Count > 0)
|
||||
{
|
||||
//更新速度信息
|
||||
UpdateSpeedCmdData(SpeedData);
|
||||
|
||||
ToomossLinDrive.SendLinMsg(CmdData);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("未发现配置的数据内容", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("未打开CAN通信,无法发送数据", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 循环发送数据到CAN
|
||||
/// </summary>
|
||||
public void CycleSendMsg()
|
||||
{
|
||||
if (ToomossLinDrive.OpenState)
|
||||
{
|
||||
if (ToomossLinDrive.IsCycleSend == false)
|
||||
{
|
||||
if (CmdData.Count > 0)
|
||||
{
|
||||
ToomossLinDrive.IsCycleSend = true;
|
||||
ToomossLinDrive.CmdData = CmdData;
|
||||
ToomossLinDrive.StartCycleSendMsg();
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("未发现配置的数据内容", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ToomossLinDrive.IsCycleSend = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///循环接收数据
|
||||
/// </summary>
|
||||
public void CycleReciveMsg()
|
||||
{
|
||||
if (ToomossLinDrive.OpenState)
|
||||
{
|
||||
if (ToomossLinDrive.IsCycleRevice == false)
|
||||
{
|
||||
if (ListLinLdfModel.Count > 0)
|
||||
{
|
||||
ToomossLinDrive.IsCycleRevice = true;
|
||||
ToomossLinDrive.StartCycleReviceMsg();
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("未发现配置的数据内容", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ToomossLinDrive.IsCycleRevice = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取数据值
|
||||
/// 从DBC中获取数据给数据中心集合
|
||||
/// </summary>
|
||||
/// <param name="Name"></param>
|
||||
/// <returns></returns>
|
||||
public double GetLdfValueByName(string Name)
|
||||
{
|
||||
if (!ToomossLinDrive.IsCycleRevice) return 0;
|
||||
|
||||
if (ListLinLdfModel.Any(a => a.Name == Name))
|
||||
{
|
||||
//double.TryParse(ListLinLdfModel.FindFirst(a => a.Name == Name).SignalRtValue, out double Result1);
|
||||
return double.TryParse(ListLinLdfModel.FindFirst(a => a.Name == Name).SignalRtValue.Split(" ")[0], out double Result) == true ? Result : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 速度的数据的获取
|
||||
/// 获取速度数据值
|
||||
/// 从DBC中获取Speed数据给数据中心集合
|
||||
/// </summary>
|
||||
/// <param name="Name"></param>
|
||||
/// <returns></returns>
|
||||
public double GetLdfSpeedValueBySpeedName(string Name)
|
||||
{
|
||||
if (!ToomossLinDrive.IsCycleRevice) return 0;
|
||||
|
||||
if (ListLinLdfModel.Any(a => a.Name == Name))
|
||||
{
|
||||
//double.TryParse(ListLinLdfModel.FindFirst(a => a.Name == Name).SignalRtValue, out double Result1);
|
||||
return double.TryParse(ListLinLdfModel.FindFirst(a => a.Name == Name).SignalRtValue.Split(" ")[0], out double Result) == true ? Result : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,9 @@ namespace CapMachine.Wpf.Services
|
||||
/// </summary>
|
||||
private IEventAggregator _EventAggregator { get; set; }
|
||||
public AlarmService AlarmService { get; }
|
||||
public ConfigService ConfigService { get; }
|
||||
public CanDriveService CanDriveService { get; }
|
||||
public LinDriveService LinDriveService { get; }
|
||||
public SysRunService SysRunService { get; }
|
||||
|
||||
/// <summary>
|
||||
@@ -74,10 +76,10 @@ namespace CapMachine.Wpf.Services
|
||||
/// </summary>
|
||||
private bool IsValueShow { get; set; } = true;
|
||||
|
||||
///// <summary>
|
||||
///// 仪表数据集合
|
||||
///// </summary>
|
||||
//public List<MeterRtDataModel> ListMeterRtData { get; set; }
|
||||
/// <summary>
|
||||
/// 系统拓展数据
|
||||
/// </summary>
|
||||
public SysExdInfo CurSysExdInfo { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// Tag数据集合
|
||||
@@ -108,7 +110,8 @@ namespace CapMachine.Wpf.Services
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
/// <param name="eventAggregator"></param>
|
||||
public MachineRtDataService(IEventAggregator eventAggregator, AlarmService alarmService, CanDriveService canDriveService, SysRunService sysRunService)//, AlarmService alarmService
|
||||
public MachineRtDataService(IEventAggregator eventAggregator, AlarmService alarmService, ConfigService configService,
|
||||
CanDriveService canDriveService, LinDriveService linDriveService, SysRunService sysRunService)//, AlarmService alarmService
|
||||
{
|
||||
//ConcurrentDictionary<DateTime, RecordInfo> keyValuePairs = new ConcurrentDictionary<DateTime, RecordInfo>();
|
||||
|
||||
@@ -122,7 +125,9 @@ namespace CapMachine.Wpf.Services
|
||||
//事件服务
|
||||
_EventAggregator = eventAggregator;
|
||||
AlarmService = alarmService;
|
||||
ConfigService = configService;
|
||||
CanDriveService = canDriveService;
|
||||
LinDriveService = linDriveService;
|
||||
SysRunService = sysRunService;
|
||||
|
||||
//秒触发一次
|
||||
@@ -132,6 +137,7 @@ namespace CapMachine.Wpf.Services
|
||||
CycleTimer.Enabled = true;
|
||||
|
||||
|
||||
|
||||
#region 标签管理
|
||||
|
||||
//【测试】
|
||||
@@ -637,7 +643,7 @@ namespace CapMachine.Wpf.Services
|
||||
Name = "通讯母线电压[V]",//名称带单位
|
||||
NameNoUnit = "通讯母线电压",//无单位名称
|
||||
EnName = "ComCapBusVol",//英文名称
|
||||
Group = "CAN",//分组
|
||||
Group = "CANLIN",//分组
|
||||
MinValue = 0,
|
||||
MaxValue = 100,
|
||||
Unit = "V",
|
||||
@@ -656,7 +662,7 @@ namespace CapMachine.Wpf.Services
|
||||
Name = "通讯母线电流[A]",//名称带单位
|
||||
NameNoUnit = "通讯母线电流",//无单位名称
|
||||
EnName = "ComCapBusCur",//英文名称
|
||||
Group = "CAN",//分组
|
||||
Group = "CANLIN",//分组
|
||||
MinValue = 0,
|
||||
MaxValue = 100,
|
||||
Unit = "A",
|
||||
@@ -675,7 +681,7 @@ namespace CapMachine.Wpf.Services
|
||||
Name = "通讯相电流[A]",//名称带单位
|
||||
NameNoUnit = "通讯相电流",//无单位名称
|
||||
EnName = "ComCapPhCur",//英文名称
|
||||
Group = "CAN",//分组
|
||||
Group = "CANLIN",//分组
|
||||
MinValue = 0,
|
||||
MaxValue = 100,
|
||||
Unit = "A",
|
||||
@@ -694,7 +700,7 @@ namespace CapMachine.Wpf.Services
|
||||
Name = "通讯功率[W]",//名称带单位
|
||||
NameNoUnit = "通讯功率",//无单位名称
|
||||
EnName = "ComCapPw",//英文名称
|
||||
Group = "CAN",//分组
|
||||
Group = "CANLIN",//分组
|
||||
MinValue = 0,
|
||||
MaxValue = 100,
|
||||
Unit = "W",
|
||||
@@ -713,7 +719,7 @@ namespace CapMachine.Wpf.Services
|
||||
Name = "通讯芯片温度[℃]",//名称带单位
|
||||
NameNoUnit = "通讯芯片温度",//无单位名称
|
||||
EnName = "ComCapChipTemp",//英文名称
|
||||
Group = "CAN",//分组
|
||||
Group = "CANLIN",//分组
|
||||
MinValue = 0,
|
||||
MaxValue = 100,
|
||||
Unit = "℃",
|
||||
@@ -858,7 +864,10 @@ namespace CapMachine.Wpf.Services
|
||||
|
||||
InitialPLCCom();
|
||||
|
||||
PubRtDataStart();
|
||||
//拓展的参数信息
|
||||
CurSysExdInfo = new SysExdInfo(SiemensDrive);
|
||||
|
||||
//PubRtDataStart();
|
||||
}
|
||||
|
||||
|
||||
@@ -1060,6 +1069,11 @@ namespace CapMachine.Wpf.Services
|
||||
/// </summary>
|
||||
private OperateResult<bool[]> OperateResultAlarm { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间诊断
|
||||
/// </summary>
|
||||
private Stopwatch DiagnosticsTime { get; set; } = new Stopwatch();
|
||||
|
||||
/// <summary>
|
||||
/// PLC扫描线程
|
||||
/// </summary>
|
||||
@@ -1071,10 +1085,11 @@ namespace CapMachine.Wpf.Services
|
||||
|
||||
while (ThreadEnable)
|
||||
{
|
||||
await Task.Delay(10);
|
||||
//await Task.Delay(5);
|
||||
await Task.CompletedTask;
|
||||
|
||||
//DiagnosticsTime.Reset();
|
||||
//DiagnosticsTime.Start();
|
||||
DiagnosticsTime.Reset();
|
||||
DiagnosticsTime.Start();
|
||||
try
|
||||
{
|
||||
//TagInfo.RtValue.Value++;
|
||||
@@ -1114,13 +1129,34 @@ namespace CapMachine.Wpf.Services
|
||||
TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.IsShow = IsValueShow;
|
||||
|
||||
////仿真数据
|
||||
////TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = (short)Random.Next(1, 100);
|
||||
////TagManger.GetTagByName<short>(itemTag.Value.Name).EngPvValue = (short)Random.Next(1, 100) * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
|
||||
////LinkState = false;
|
||||
//TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = (short)Random.Next(1, 100);
|
||||
//TagManger.GetTagByName<short>(itemTag.Value.Name).EngPvValue = (short)Random.Next(1, 100) * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
|
||||
//LinkState = false;
|
||||
|
||||
//PLC 数据
|
||||
if (!string.IsNullOrEmpty(itemTag.Value.PVAddress))
|
||||
{
|
||||
//反写CANLIN速度数据到PLC,提前写入PLC,后面会回读PV值
|
||||
if (itemTag.Value.NameNoUnit == "转速")
|
||||
{
|
||||
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
|
||||
{
|
||||
case CanLinEnum.Can:
|
||||
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
|
||||
SiemensDrive.Write(itemTag.Value.PVAddress, (short)CanDriveService.GetDbcSpeedValueBySpeedName("通讯转速"));
|
||||
//itemTag.Value.EngPvValue = 0;
|
||||
break;
|
||||
case CanLinEnum.Lin:
|
||||
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
|
||||
SiemensDrive.Write(itemTag.Value.PVAddress, (short)LinDriveService.GetLdfSpeedValueBySpeedName("通讯转速"));
|
||||
//itemTag.Value.EngPvValue = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
OperateResultShort = SiemensDrive.ReadInt16(itemTag.Value.PVAddress);
|
||||
if (OperateResultShort.IsSuccess)
|
||||
{
|
||||
@@ -1133,17 +1169,34 @@ namespace CapMachine.Wpf.Services
|
||||
LinkState = false;
|
||||
}
|
||||
|
||||
//CAN数据读取 //回读CAN通信的数据到集合中
|
||||
//CAN组合并且在循环接收数据中时,才读取数据
|
||||
if (itemTag.Value.Group == "CAN")
|
||||
//根据CANLIN的选择,读取对应的解析实时数据更新到数据中心,这些数据相当于都是PV的实时数据
|
||||
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
|
||||
{
|
||||
//回读CAN通信的DBC集合数据到集合中
|
||||
itemTag.Value.EngPvValue = CanDriveService.GetDbcValueByName(itemTag.Value.NameNoUnit);
|
||||
case CanLinEnum.Can:
|
||||
//CAN数据读取 //回读CAN通信的数据到集合中
|
||||
//CAN组合并且在循环接收数据中时,才读取数据
|
||||
if (itemTag.Value.Group == "CANLIN")
|
||||
{
|
||||
//回读CAN通信的DBC集合数据到集合中
|
||||
itemTag.Value.EngPvValue = CanDriveService.GetDbcValueByName(itemTag.Value.NameNoUnit);
|
||||
}
|
||||
break;
|
||||
case CanLinEnum.Lin:
|
||||
//LIN数据读取 //回读LIN通信的数据到集合中
|
||||
//LIN组合并且在循环接收数据中时,才读取数据
|
||||
if (itemTag.Value.Group == "CANLIN")
|
||||
{
|
||||
//回读LIN通信的DBC集合数据到集合中
|
||||
itemTag.Value.EngPvValue = LinDriveService.GetLdfValueByName(itemTag.Value.NameNoUnit);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else //地址为空,PLC驱动不读取数据
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(itemTag.Value.SVAddress))
|
||||
@@ -1207,7 +1260,6 @@ namespace CapMachine.Wpf.Services
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//循环读取手自动切换
|
||||
foreach (var item in ListHandSwitchData)
|
||||
{
|
||||
@@ -1218,7 +1270,12 @@ namespace CapMachine.Wpf.Services
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//拓展信息的展示
|
||||
foreach (var itemQuickTag in CurSysExdInfo.QuickTags)
|
||||
{
|
||||
itemQuickTag.OperateResultSource = SiemensDrive.Read(itemQuickTag.ValueAddress, itemQuickTag.ByteLength);
|
||||
}
|
||||
CurSysExdInfo.SumRunTime();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1227,9 +1284,9 @@ namespace CapMachine.Wpf.Services
|
||||
|
||||
}
|
||||
|
||||
|
||||
//DiagnosticsTime.Stop();
|
||||
//ScanRtTimeinfo = $"电表:{DiagnosticsTime.Elapsed.TotalMilliseconds.ToString()}";
|
||||
DiagnosticsTime.Stop();
|
||||
ConfigService.PlcCycleTime = (int)DiagnosticsTime.Elapsed.TotalMilliseconds;
|
||||
//Console.WriteLine($"扫描时间:{DiagnosticsTime.Elapsed.TotalMilliseconds.ToString()}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ namespace CapMachine.Wpf.Services
|
||||
//}));
|
||||
MenuItems.Add(new NavigationItem("", "工艺过程", "MonitorView"));
|
||||
MenuItems.Add(new NavigationItem("", "CAN配置", "CANConfigView"));
|
||||
MenuItems.Add(new NavigationItem("", "LIN配置", "LINConfigView"));
|
||||
MenuItems.Add(new NavigationItem("", "工艺参数", "ProConfigView"));
|
||||
MenuItems.Add(new NavigationItem("", "工艺曲线", "RealTimeChartView"));
|
||||
MenuItems.Add(new NavigationItem("", "动作日志", "ActionLogView"));
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
CategoryComboBoxList = new List<ComboBoxModel>()
|
||||
{
|
||||
new ComboBoxModel(){Key="0",Text="系统日志" },
|
||||
new ComboBoxModel(){Key="1",Text="程序步骤" },
|
||||
//new ComboBoxModel(){Key="1",Text="程序步骤" },
|
||||
new ComboBoxModel(){Key="2",Text="历史报警" },
|
||||
};
|
||||
}
|
||||
@@ -210,12 +210,14 @@ namespace CapMachine.Wpf.ViewModels
|
||||
//多条件查询
|
||||
if (!string.IsNullOrEmpty(SearchStartDate))
|
||||
{
|
||||
MulConHistoryAlarmQueryable = MulConHistoryAlarmQueryable.Where(t => t.CreateTime.Date >= Convert.ToDateTime(SearchStartDate));
|
||||
var Start = DateTime.Parse(SearchStartDate);
|
||||
MulConHistoryAlarmQueryable = MulConHistoryAlarmQueryable.Where(t => t.CreateTime.Date >= Convert.ToDateTime(Start));
|
||||
}
|
||||
//多条件查询
|
||||
if (!string.IsNullOrEmpty(SearchEndDate))
|
||||
{
|
||||
MulConHistoryAlarmQueryable = MulConHistoryAlarmQueryable.Where(t => t.CreateTime.Date < Convert.ToDateTime(SearchEndDate).AddDays(1));
|
||||
var End = DateTime.Parse(SearchEndDate);
|
||||
MulConHistoryAlarmQueryable = MulConHistoryAlarmQueryable.Where(t => t.CreateTime.Date < Convert.ToDateTime(End).AddDays(1));
|
||||
}
|
||||
var ListHistoryAlarmDpI = MulConHistoryAlarmQueryable.OrderByDescending(a => a.CreateTime).ToList();//.Where(a => a.CreateTime >= DateTime.Now);
|
||||
|
||||
@@ -228,12 +230,14 @@ namespace CapMachine.Wpf.ViewModels
|
||||
//多条件查询
|
||||
if (!string.IsNullOrEmpty(SearchStartDate))
|
||||
{
|
||||
MulConActionLogQueryable = MulConActionLogQueryable.Where(t => t.CreateTime.Date >= Convert.ToDateTime(SearchStartDate));
|
||||
var Start = DateTime.Parse(SearchStartDate);
|
||||
MulConActionLogQueryable = MulConActionLogQueryable.Where(t => t.CreateTime.Date >= Convert.ToDateTime(Start));
|
||||
}
|
||||
//多条件查询
|
||||
if (!string.IsNullOrEmpty(SearchEndDate))
|
||||
{
|
||||
MulConActionLogQueryable = MulConActionLogQueryable.Where(t => t.CreateTime.Date < Convert.ToDateTime(SearchEndDate).AddDays(1));
|
||||
var End = DateTime.Parse(SearchEndDate);
|
||||
MulConActionLogQueryable = MulConActionLogQueryable.Where(t => t.CreateTime.Date < Convert.ToDateTime(End).AddDays(1));
|
||||
}
|
||||
var ListActionLogDpI = MulConActionLogQueryable.OrderByDescending(a => a.CreateTime).ToList();//.Where(a => a.CreateTime >= DateTime.Now);
|
||||
ListModelDto = new ObservableCollection<object>(Mapper.Map<List<ActionLogDto>>(ListActionLogDpI));
|
||||
|
||||
@@ -25,6 +25,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using static CapMachine.Wpf.Models.ComEnum;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
@@ -35,6 +36,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public CANConfigViewModel(IDialogService dialogService, IFreeSql freeSql,
|
||||
IEventAggregator eventAggregator, IRegionManager regionManager, SysRunService sysRunService,
|
||||
ComActionService actionService,
|
||||
ConfigService configService, CanDriveService canDriveService,
|
||||
IMapper mapper, MachineRtDataService machineRtDataService)
|
||||
{
|
||||
@@ -43,6 +45,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
EventAggregator = eventAggregator;
|
||||
RegionManager = regionManager;
|
||||
SysRunService = sysRunService;
|
||||
ComActionService = actionService;
|
||||
ConfigService = configService;
|
||||
CanDriveService = canDriveService;
|
||||
Mapper = mapper;
|
||||
@@ -80,6 +83,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
public IEventAggregator EventAggregator { get; }
|
||||
public IRegionManager RegionManager { get; }
|
||||
public SysRunService SysRunService { get; }
|
||||
public ComActionService ComActionService { get; }
|
||||
public ConfigService ConfigService { get; }
|
||||
public CanDriveService CanDriveService { get; }
|
||||
public IMapper Mapper { get; }
|
||||
@@ -329,23 +333,42 @@ namespace CapMachine.Wpf.ViewModels
|
||||
}
|
||||
break;
|
||||
case "Active":
|
||||
if (SelectCanLinConfigPro != null)
|
||||
|
||||
//激活到取消的状态的判断
|
||||
if (IsCanConfigProActive==true)
|
||||
{
|
||||
//控件的激活
|
||||
IsCanConfigProActive = !IsCanConfigProActive;
|
||||
//控件的激活配置信息
|
||||
IsCANConfigDatagridActive = !IsCanConfigProActive;
|
||||
|
||||
//当前使用的CAN 配置信息
|
||||
CanDriveService.InitCanConfig(SelectCanLinConfigPro);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((CanDriveService.ToomossCanDrive.OpenState == true && CanDriveService.ToomossCanDrive.DbcParserState == true))
|
||||
{
|
||||
if (SelectCanLinConfigPro != null)
|
||||
{
|
||||
//控件的激活
|
||||
IsCanConfigProActive = !IsCanConfigProActive;
|
||||
//控件的激活配置信息
|
||||
IsCANConfigDatagridActive = !IsCanConfigProActive;
|
||||
|
||||
//当前使用的CAN 配置信息
|
||||
CanDriveService.InitCanConfig(SelectCanLinConfigPro);
|
||||
|
||||
InitLoadCanConfigPro();
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("选中后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
}
|
||||
|
||||
InitLoadCanConfigPro();
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("选中后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
System.Windows.MessageBox.Show("请确保CAN连接打开和Dbc解析成功后再激活", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -579,7 +602,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("新建CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
System.Windows.MessageBox.Show("选中CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
}
|
||||
|
||||
|
||||
@@ -754,10 +777,17 @@ namespace CapMachine.Wpf.ViewModels
|
||||
switch (Par)
|
||||
{
|
||||
case "Open":
|
||||
if (ComActionService.IsCanToDoWork()==false)
|
||||
{
|
||||
System.Windows.MessageBox.Show("请关闭LIN连接后才能开启CAN,同一个时刻只能有一个通信驱动压缩机", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
return;
|
||||
}
|
||||
if (SelectCanLinConfigPro != null && SelectedCANConfigExdDto != null)
|
||||
{
|
||||
//打开连接
|
||||
CanDriveService.ToomossCanDrive.StartCanDrive();
|
||||
//系统使用了CAN
|
||||
ConfigService.CanLinRunStateModel.CurSysSelectedCanLin = CanLinEnum.Can;
|
||||
//CAN DBC配置 有DBC配置的话,则直接加载DBC信息
|
||||
if (!string.IsNullOrEmpty(SelectCanLinConfigPro.CANConfigExd.DbcPath))
|
||||
{
|
||||
@@ -767,7 +797,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("新建CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
System.Windows.MessageBox.Show("选中CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -776,11 +806,12 @@ namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
|
||||
CanDriveService.ToomossCanDrive.CloseDevice();
|
||||
|
||||
//系统取消使用了CAN
|
||||
ConfigService.CanLinRunStateModel.CurSysSelectedCanLin = CanLinEnum.No;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("新建CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
System.Windows.MessageBox.Show("选中CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -802,7 +833,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("新建CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
System.Windows.MessageBox.Show("选中CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -837,7 +868,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("新建CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
System.Windows.MessageBox.Show("选中CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1004,7 +1035,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
if (SelectCanLinConfigPro == null)
|
||||
{
|
||||
System.Windows.MessageBox.Show("新建CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
System.Windows.MessageBox.Show("选中CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1139,7 +1170,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
if (SelectCanLinConfigPro == null)
|
||||
{
|
||||
System.Windows.MessageBox.Show("新建CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
System.Windows.MessageBox.Show("选中CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public DialogCanLinConfigCreateViewModel()
|
||||
{
|
||||
|
||||
this.Title = "Can/LIN程序名称配置";
|
||||
}
|
||||
|
||||
private string name;
|
||||
|
||||
60
CapMachine.Wpf/ViewModels/HostDialogViewModel.cs
Normal file
60
CapMachine.Wpf/ViewModels/HostDialogViewModel.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using CapMachine.Wpf.Services;
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Services.Dialogs;
|
||||
using Prism.Ioc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public abstract class HostDialogViewModel : BindableBase, IHostDialogAware
|
||||
{
|
||||
public string Title { get; set; }
|
||||
|
||||
public string IdentifierName { get; set; }
|
||||
|
||||
public DelegateCommand SaveCommand { get; private set; }
|
||||
|
||||
public DelegateCommand CancelCommand { get; private set; }
|
||||
|
||||
private IHostDialogService dialogService;
|
||||
|
||||
public HostDialogViewModel()
|
||||
{
|
||||
SaveCommand = new DelegateCommand(async () => await Save());
|
||||
CancelCommand = new DelegateCommand(Cancel);
|
||||
|
||||
dialogService = ContainerLocator.Container.Resolve<IHostDialogService>();
|
||||
}
|
||||
|
||||
public virtual void Cancel()
|
||||
{
|
||||
dialogService.Close(IdentifierName, new DialogResult(ButtonResult.No));
|
||||
}
|
||||
|
||||
public virtual async Task Save()
|
||||
{
|
||||
dialogService.Close(IdentifierName, new DialogResult(ButtonResult.OK));
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
protected virtual void Save(object value)
|
||||
{
|
||||
DialogParameters param = new DialogParameters();
|
||||
param.Add("Value", value);
|
||||
|
||||
dialogService.Close(IdentifierName, new DialogResult(ButtonResult.OK, param));
|
||||
}
|
||||
|
||||
protected virtual void Save(DialogParameters param)
|
||||
{
|
||||
dialogService.Close(IdentifierName, new DialogResult(ButtonResult.OK, param));
|
||||
}
|
||||
|
||||
public abstract void OnDialogOpened(IDialogParameters parameters);
|
||||
}
|
||||
}
|
||||
1224
CapMachine.Wpf/ViewModels/LinConfigViewModel.cs
Normal file
1224
CapMachine.Wpf/ViewModels/LinConfigViewModel.cs
Normal file
File diff suppressed because it is too large
Load Diff
55
CapMachine.Wpf/ViewModels/SplashScreenViewModel.cs
Normal file
55
CapMachine.Wpf/ViewModels/SplashScreenViewModel.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using CapMachine.Core;
|
||||
using CapMachine.Wpf.Services;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public class SplashScreenViewModel : DialogViewModel
|
||||
{
|
||||
private readonly IApplicationContext applicationContext;
|
||||
|
||||
private string displayText;
|
||||
|
||||
public string DisplayText
|
||||
{
|
||||
get { return displayText; }
|
||||
set { displayText = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
public SplashScreenViewModel(
|
||||
IApplicationContext applicationContext
|
||||
)
|
||||
{
|
||||
this.applicationContext = applicationContext;
|
||||
|
||||
}
|
||||
|
||||
public override async void OnDialogOpened(IDialogParameters parameters)
|
||||
{
|
||||
await SetBusyAsync(async () =>
|
||||
{
|
||||
await Task.Delay(2000);
|
||||
|
||||
//加载本地的缓存信息
|
||||
DisplayText = "Initializing";
|
||||
|
||||
OnDialogClosed();
|
||||
//OnDialogClosed(ButtonResult.OK);
|
||||
|
||||
////如果本地授权存在,直接进入系统首页
|
||||
//if (accessTokenManager.IsUserLoggedIn && applicationContext.Configuration != null)
|
||||
// OnDialogClosed();
|
||||
//else if (applicationContext.Configuration != null)
|
||||
// OnDialogClosed(ButtonResult.Ignore);
|
||||
//else
|
||||
// OnDialogClosed(ButtonResult.No);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
41
CapMachine.Wpf/ViewModels/TaskBarViewModel.cs
Normal file
41
CapMachine.Wpf/ViewModels/TaskBarViewModel.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using CapMachine.Wpf.Services;
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Ioc;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public class TaskBarViewModel : BindableBase
|
||||
{
|
||||
private readonly IHostDialogService dialog;
|
||||
private readonly IAppStartService appStartService;
|
||||
public DelegateCommand ExitCommand { get; set; }
|
||||
public DelegateCommand ShowViewCommand { get; private set; }
|
||||
|
||||
public TaskBarViewModel()
|
||||
{
|
||||
dialog = ContainerLocator.Container.Resolve<IHostDialogService>();
|
||||
appStartService = ContainerLocator.Container.Resolve<IAppStartService>();
|
||||
|
||||
ExitCommand = new DelegateCommand(Exit);
|
||||
ShowViewCommand = new DelegateCommand(ShowView);
|
||||
}
|
||||
|
||||
private async void Exit()
|
||||
{
|
||||
ShowView();
|
||||
|
||||
if (await dialog.Question("确定","1"))
|
||||
appStartService.Exit();
|
||||
}
|
||||
|
||||
private void ShowView()
|
||||
{
|
||||
if (!App.Current.MainWindow.IsVisible)
|
||||
{
|
||||
App.Current.MainWindow.Show();
|
||||
App.Current.MainWindow.WindowState = System.Windows.WindowState.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -459,7 +459,7 @@
|
||||
Text="" />
|
||||
<TextBlock Style="{StaticResource TextBlockStyle}" Text="CAN连接状态" />
|
||||
<Border
|
||||
Width="90"
|
||||
Width="50"
|
||||
Margin="5,10"
|
||||
Padding="5"
|
||||
CornerRadius="3">
|
||||
@@ -476,14 +476,38 @@
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="White"
|
||||
Text="" />
|
||||
Text="连接" />
|
||||
</Border>
|
||||
<!-- Dbc解析 -->
|
||||
<Border
|
||||
Width="60"
|
||||
Margin="5,10"
|
||||
Padding="5"
|
||||
CornerRadius="3">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding CanDriveService.ToomossCanDrive.DbcParserState}" Value="True">
|
||||
<Setter Property="Background" Value="LimeGreen" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding CanDriveService.ToomossCanDrive.DbcParserState}" Value="False">
|
||||
<Setter Property="Background" Value="Gray" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="White"
|
||||
Text="Dbc解析" />
|
||||
</Border>
|
||||
|
||||
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Margin="15,0,5,0"
|
||||
Command="{Binding CanOpCmd}"
|
||||
CommandParameter="CycleSend">
|
||||
<Button.Style>
|
||||
|
||||
@@ -69,8 +69,51 @@
|
||||
FontSize="16"
|
||||
Foreground="White"
|
||||
Text="{Binding MachineRtDataService.LinkState, Converter={StaticResource BoolOkStrConvert}}" />
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
FontSize="16"
|
||||
Foreground="White"
|
||||
Text="|" />
|
||||
<TextBlock
|
||||
Margin="5,0"
|
||||
FontSize="16"
|
||||
Foreground="White"
|
||||
Text="{Binding ConfigService.PlcCycleTime}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border>
|
||||
<Border.Style>
|
||||
<Style BasedOn="{StaticResource BoardStyle}" TargetType="Border">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ConfigService.CanLinRunStateModel.CanLinRunState}" Value="true">
|
||||
<Setter Property="Background" Value="LimeGreen" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ConfigService.CanLinRunStateModel.CanLinRunState}" Value="false">
|
||||
<Setter Property="Background" Value="Gray" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<StackPanel Style="{StaticResource StackPanelStyle}">
|
||||
<TextBlock
|
||||
Margin="5,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="16"
|
||||
Foreground="White"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
FontSize="16"
|
||||
Foreground="White"
|
||||
Text="压缩机驱动:" />
|
||||
<TextBlock
|
||||
Margin="5,0"
|
||||
FontSize="16"
|
||||
Foreground="White"
|
||||
Text="{Binding ConfigService.CanLinRunStateModel.SelectedCanLinMsg}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border>
|
||||
<Border.Style>
|
||||
<Style BasedOn="{StaticResource BoardStyle}" TargetType="Border">
|
||||
|
||||
990
CapMachine.Wpf/Views/LINConfigView.xaml
Normal file
990
CapMachine.Wpf/Views/LINConfigView.xaml
Normal file
@@ -0,0 +1,990 @@
|
||||
<UserControl
|
||||
x:Class="CapMachine.Wpf.Views.LINConfigView"
|
||||
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:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:CapMachine.Wpf.Views"
|
||||
xmlns:localEx="clr-namespace:CapMachine.Wpf"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
d:DesignHeight="980"
|
||||
d:DesignWidth="1920"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<localEx:BindingProxy x:Key="Proxy" Data="{Binding}" />
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<materialDesign:Card
|
||||
Margin="3"
|
||||
Background="{DynamicResource MaterialDesignLightBackground}"
|
||||
Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
|
||||
UniformCornerRadius="5">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
|
||||
<TextBlock
|
||||
Margin="10,0,10,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="30"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
Margin="5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="30"
|
||||
FontWeight="Bold"
|
||||
Text="LIN LDF 文件路径:" />
|
||||
<Border
|
||||
Width="800"
|
||||
Margin="5,8"
|
||||
Padding="15,5"
|
||||
Background="LightGray"
|
||||
CornerRadius="5">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="22"
|
||||
Text="{Binding SelectedLINConfigExdDto.LdfPath}" />
|
||||
</Border>
|
||||
|
||||
<Button Command="{Binding LoadLdfCmd}" Foreground="White">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text=" " />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="选择Ldf文件" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</materialDesign:Card>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="400" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="550" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid Margin="3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60" />
|
||||
<RowDefinition Height="46" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<materialDesign:Card
|
||||
Margin="0,1,0,3"
|
||||
Background="{DynamicResource MaterialDesignLightBackground}"
|
||||
Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
|
||||
UniformCornerRadius="5">
|
||||
<StackPanel
|
||||
Margin="5"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="2,0"
|
||||
Command="{Binding CanLinConfigPromdCmd}"
|
||||
CommandParameter="Add"
|
||||
Foreground="White">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="新建" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
Margin="2,0"
|
||||
Command="{Binding CanLinConfigPromdCmd}"
|
||||
CommandParameter="Edit"
|
||||
Foreground="White">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="修改" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
Margin="2,0"
|
||||
Command="{Binding CanLinConfigPromdCmd}"
|
||||
CommandParameter="Delete"
|
||||
Foreground="White">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="删除" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
Margin="2,0"
|
||||
Command="{Binding CanLinConfigPromdCmd}"
|
||||
CommandParameter="Active"
|
||||
Foreground="White"
|
||||
ToolTip="【激活】代表启用选择的LIN配置为当前的工况所使用,激活后程序运行中不可改变LIN配置">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock VerticalAlignment="Center" FontSize="14">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsLinConfigProActive}" Value="True">
|
||||
<Setter Property="Text" Value="取消" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsLinConfigProActive}" Value="False">
|
||||
<Setter Property="Text" Value="激活" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
</StackPanel>
|
||||
</materialDesign:Card>
|
||||
<materialDesign:Card
|
||||
Grid.Row="1"
|
||||
Margin="0,1,0,3"
|
||||
Background="{DynamicResource MaterialDesignLightBackground}"
|
||||
Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
|
||||
UniformCornerRadius="5">
|
||||
<Border CornerRadius="5">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsLinConfigProActive}" Value="True">
|
||||
<Setter Property="Background" Value="LimeGreen" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsLinConfigProActive}" Value="False">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="24"
|
||||
Foreground="Blue"
|
||||
Text="{Binding SelectCanLinConfigProConfigName}" />
|
||||
</Border>
|
||||
<!--<StackPanel
|
||||
Margin="5"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
|
||||
|
||||
</StackPanel>-->
|
||||
</materialDesign:Card>
|
||||
|
||||
<DataGrid
|
||||
x:Name="LINConfigDatagrid"
|
||||
Grid.Row="2"
|
||||
AutoGenerateColumns="False"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1"
|
||||
FontWeight="Bold"
|
||||
IsHitTestVisible="{Binding IsLINConfigDatagridActive}"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding ListCanLinConfigPro}"
|
||||
SelectionMode="Extended"
|
||||
SelectionUnit="FullRow">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="350" Binding="{Binding ConfigName}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="LIN配置名称" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
|
||||
</DataGrid.Columns>
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<prism:InvokeCommandAction Command="{Binding LinConfigProGridSelectionChangedCmd}" CommandParameter="{Binding ElementName=LINConfigDatagrid, Path=SelectedItem}" />
|
||||
</i:EventTrigger>
|
||||
<i:EventTrigger EventName="PreviewMouseLeftButtonDown">
|
||||
<prism:InvokeCommandAction Command="{Binding LinConfigProGridPreviewMouseLeftButtonDownCmd}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
|
||||
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Column="1" Margin="3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="200" />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<materialDesign:Card
|
||||
Margin="0,1,0,3"
|
||||
Background="{DynamicResource MaterialDesignLightBackground}"
|
||||
Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
|
||||
UniformCornerRadius="5">
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
<Style
|
||||
x:Key="TextBoxStyle"
|
||||
BasedOn="{StaticResource MaterialDesignTextBoxBase}"
|
||||
TargetType="TextBox">
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Margin" Value="10,0" />
|
||||
<Setter Property="Width" Value="80" />
|
||||
</Style>
|
||||
<Style x:Key="TextBlockStyle" TargetType="TextBlock">
|
||||
<Setter Property="Width" Value="110" />
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Margin" Value="5,0" />
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="2*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Margin="5" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="5,0,10,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="24"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="24"
|
||||
FontWeight="Bold"
|
||||
Text="LIN通信配置" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="0,0,15,0"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Command="{Binding LinOpCmd}"
|
||||
CommandParameter="Open"
|
||||
Foreground="White">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="连接LIN" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Command="{Binding LinOpCmd}"
|
||||
CommandParameter="Close"
|
||||
Foreground="White">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="关闭LIN" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Command="{Binding LinOpCmd}"
|
||||
CommandParameter="Parse"
|
||||
Foreground="White">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="解析Ldf" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Command="{Binding LinOpCmd}"
|
||||
CommandParameter="Save"
|
||||
Foreground="White">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="保存配置" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="10,0,10,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock Style="{StaticResource TextBlockStyle}" Text="波特率" />
|
||||
<TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding SelectedLINConfigExdDto.BaudRate}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="10,0,10,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock Style="{StaticResource TextBlockStyle}" Text="循环周期(ms)" />
|
||||
<TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding SelectedLINConfigExdDto.Cycle}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="0,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
Width="86"
|
||||
Style="{StaticResource TextBlockStyle}"
|
||||
Text="转速(rpm)" />
|
||||
<TextBox
|
||||
Margin="5,0"
|
||||
Style="{StaticResource TextBoxStyle}"
|
||||
Text="{Binding HandSpeed}" />
|
||||
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Command="{Binding LinOpCmd}"
|
||||
CommandParameter="HandSend"
|
||||
Content="手动发送"
|
||||
Foreground="White" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
Grid.ColumnSpan="3"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="10,0,10,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock Style="{StaticResource TextBlockStyle}" Text="LIN连接状态" />
|
||||
<Border
|
||||
Width="50"
|
||||
Margin="5,10"
|
||||
Padding="5"
|
||||
CornerRadius="3">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding LinDriveService.ToomossLinDrive.OpenState}" Value="True">
|
||||
<Setter Property="Background" Value="LimeGreen" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding LinDriveService.ToomossLinDrive.OpenState}" Value="False">
|
||||
<Setter Property="Background" Value="Gray" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="White"
|
||||
Text="连接" />
|
||||
</Border>
|
||||
<Border
|
||||
Width="60"
|
||||
Margin="5,10"
|
||||
Padding="5"
|
||||
CornerRadius="3">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding LinDriveService.ToomossLinDrive.LdfParserState}" Value="True">
|
||||
<Setter Property="Background" Value="LimeGreen" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding LinDriveService.ToomossLinDrive.LdfParserState}" Value="False">
|
||||
<Setter Property="Background" Value="Gray" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="White"
|
||||
Text="Ldf解析" />
|
||||
</Border>
|
||||
|
||||
<Button
|
||||
Margin="15,0,5,0"
|
||||
Command="{Binding LinOpCmd}"
|
||||
CommandParameter="CycleSend">
|
||||
<Button.Style>
|
||||
<Style BasedOn="{StaticResource MaterialDesignFlatDarkBgButton}" TargetType="Button">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding LinDriveService.ToomossLinDrive.IsCycleSend}" Value="true">
|
||||
<Setter Property="Background" Value="LimeGreen" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding LinDriveService.ToomossLinDrive.IsCycleSend}" Value="false">
|
||||
<Setter Property="Background" Value="Gray" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Button.Style>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="循环发送" />
|
||||
</StackPanel>
|
||||
|
||||
</Button>
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Command="{Binding LinOpCmd}"
|
||||
CommandParameter="CycleRecive">
|
||||
<Button.Style>
|
||||
<Style BasedOn="{StaticResource MaterialDesignFlatDarkBgButton}" TargetType="Button">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding LinDriveService.ToomossLinDrive.IsCycleRevice}" Value="true">
|
||||
<Setter Property="Background" Value="LimeGreen" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding LinDriveService.ToomossLinDrive.IsCycleRevice}" Value="false">
|
||||
<Setter Property="Background" Value="Gray" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Button.Style>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="循环接收" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</materialDesign:Card>
|
||||
|
||||
<materialDesign:Card
|
||||
Grid.Row="1"
|
||||
Margin="0,2,0,3"
|
||||
Background="{DynamicResource MaterialDesignLightBackground}"
|
||||
Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
|
||||
UniformCornerRadius="5">
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
<Style
|
||||
x:Key="TextBoxStyle"
|
||||
BasedOn="{StaticResource MaterialDesignTextBoxBase}"
|
||||
TargetType="TextBox">
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Margin" Value="10,0" />
|
||||
<Setter Property="Width" Value="150" />
|
||||
</Style>
|
||||
<Style x:Key="TextBlockStyle" TargetType="TextBlock">
|
||||
<Setter Property="Width" Value="75" />
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Margin" Value="5,0" />
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Margin="5" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="5,0,10,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="24"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="24"
|
||||
FontWeight="Bold"
|
||||
Text="写入操作" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="0,0,15,0"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Command="{Binding WriteCmd}"
|
||||
CommandParameter="Edit"
|
||||
Foreground="White">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="修改" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Command="{Binding WriteCmd}"
|
||||
CommandParameter="Delete"
|
||||
Foreground="White">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="删除" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
<DataGrid
|
||||
x:Name="LINWriteDatagrid"
|
||||
Grid.Row="1"
|
||||
AutoGenerateColumns="False"
|
||||
BorderBrush="Black"
|
||||
CanUserAddRows="False"
|
||||
ItemsSource="{Binding ListWriteCanLinRWConfigDto}"
|
||||
SelectionMode="Extended"
|
||||
SelectionUnit="FullRow">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="200" Header="名称">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox
|
||||
DisplayMemberPath="Text"
|
||||
ItemsSource="{Binding Source={StaticResource Proxy}, Path=Data.WriteNameCbxItems}"
|
||||
SelectedValue="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedValuePath="Text" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<!--<DataGridTextColumn Width="200" Binding="{Binding Name}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="名称" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>-->
|
||||
<DataGridTextColumn Binding="{Binding SignalName}" IsReadOnly="True">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="信号内容" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding MsgFrameName}" IsReadOnly="True">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="消息名称" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
|
||||
<DataGridTextColumn Binding="{Binding DefautValue}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="默认值" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<prism:InvokeCommandAction Command="{Binding WriteGridSelectionChangedCmd}" CommandParameter="{Binding ElementName=LINWriteDatagrid, Path=SelectedItem}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
</materialDesign:Card>
|
||||
|
||||
<materialDesign:Card
|
||||
Grid.Row="2"
|
||||
Margin="0,2,0,3"
|
||||
Background="{DynamicResource MaterialDesignLightBackground}"
|
||||
Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
|
||||
UniformCornerRadius="5">
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
<Style
|
||||
x:Key="TextBoxStyle"
|
||||
BasedOn="{StaticResource MaterialDesignTextBoxBase}"
|
||||
TargetType="TextBox">
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Margin" Value="10,0" />
|
||||
<Setter Property="Width" Value="150" />
|
||||
</Style>
|
||||
<Style x:Key="TextBlockStyle" TargetType="TextBlock">
|
||||
<Setter Property="Width" Value="75" />
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Margin" Value="5,0" />
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Margin="5" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="5,0,10,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="24"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="24"
|
||||
FontWeight="Bold"
|
||||
Text="读取操作" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="0,0,15,0"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Command="{Binding ReadCmd}"
|
||||
CommandParameter="Edit"
|
||||
Foreground="White">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="修改" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Command="{Binding ReadCmd}"
|
||||
CommandParameter="Delete"
|
||||
Foreground="White">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="删除" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<DataGrid
|
||||
x:Name="LINReadDatagrid"
|
||||
Grid.Row="1"
|
||||
AutoGenerateColumns="False"
|
||||
BorderBrush="Black"
|
||||
CanUserAddRows="False"
|
||||
ItemsSource="{Binding ListReadCanLinRWConfigDto}"
|
||||
SelectionMode="Extended"
|
||||
SelectionUnit="FullRow">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="200" Header="名称">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox
|
||||
DisplayMemberPath="Text"
|
||||
ItemsSource="{Binding Source={StaticResource Proxy}, Path=Data.ReadNameCbxItems}"
|
||||
SelectedValue="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedValuePath="Text" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<!--<DataGridTextColumn Width="200" Binding="{Binding Name}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="名称" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>-->
|
||||
<DataGridTextColumn Binding="{Binding SignalName}" IsReadOnly="True">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="信号名称" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding MsgFrameName}" IsReadOnly="True">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="消息名称" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding DefautValue}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="默认值" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<prism:InvokeCommandAction Command="{Binding ReadGridSelectionChangedCmd}" CommandParameter="{Binding ElementName=LINReadDatagrid, Path=SelectedItem}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
</materialDesign:Card>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Column="2" Margin="3">
|
||||
<!--<Grid.RowDefinitions>
|
||||
<RowDefinition Height="60" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>-->
|
||||
|
||||
<!--<materialDesign:Card
|
||||
Margin="0,1,0,3"
|
||||
Background="{DynamicResource MaterialDesignLightBackground}"
|
||||
Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
|
||||
UniformCornerRadius="5">
|
||||
<StackPanel Margin="5" Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Content="连接LIN"
|
||||
Foreground="White" />
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Content="关闭LIN"
|
||||
Foreground="White" />
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Content="保存配置"
|
||||
Foreground="White" />
|
||||
</StackPanel>
|
||||
</materialDesign:Card>-->
|
||||
|
||||
<DataGrid
|
||||
x:Name="LdfDatagrid"
|
||||
AutoGenerateColumns="False"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1"
|
||||
CanUserAddRows="False"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding ListLinLdfModel}"
|
||||
SelectionMode="Extended"
|
||||
SelectionUnit="FullRow">
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="ContextMenu">
|
||||
<Setter.Value>
|
||||
<ContextMenu>
|
||||
<MenuItem
|
||||
Command="{Binding Source={StaticResource Proxy}, Path=Data.DataGridMenuCmd}"
|
||||
CommandParameter="Write"
|
||||
Header="添加到写入操作" />
|
||||
<MenuItem
|
||||
Command="{Binding Source={StaticResource Proxy}, Path=Data.DataGridMenuCmd}"
|
||||
CommandParameter="Read"
|
||||
Header="添加到读取操作" />
|
||||
</ContextMenu>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<!--<DataGridTextColumn Binding="{Binding MsgId}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="消息ID" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>-->
|
||||
|
||||
<DataGridTextColumn Binding="{Binding MsgName}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="消息名称" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Publisher}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="发布者" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<!--<DataGridTextColumn Binding="{Binding IsMasterFrame}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="主机帧" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>-->
|
||||
|
||||
<DataGridTextColumn Binding="{Binding SignalName}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="信号名称" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding SignalRtValue}">
|
||||
<DataGridTextColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="实时值" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
|
||||
</DataGrid.Columns>
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<prism:InvokeCommandAction Command="{Binding LdfGridSelectionChangedCmd}" CommandParameter="{Binding ElementName=LdfDatagrid, Path=SelectedItem}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
CapMachine.Wpf/Views/LINConfigView.xaml.cs
Normal file
28
CapMachine.Wpf/Views/LINConfigView.xaml.cs
Normal 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 CapMachine.Wpf.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// LINConfigView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class LINConfigView : UserControl
|
||||
{
|
||||
public LINConfigView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -168,6 +168,8 @@
|
||||
AutoHandCommand="{Binding Source={StaticResource Proxy}, Path=Data.AutoHandCmd}"
|
||||
AutoHandState="False"
|
||||
HandValueCommand="{Binding Source={StaticResource Proxy}, Path=Data.HandValueCmd}"
|
||||
HandValueMVParameter="{Binding EngMvValue}"
|
||||
HandValueSVParameter="{Binding EngSvValue}"
|
||||
MeterName="{Binding NameNoUnit}"
|
||||
PVValue="{Binding EngPvValue}"
|
||||
SVValue="{Binding EngSvValue}"
|
||||
@@ -208,7 +210,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<materialDesign:Card
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.ColumnSpan="6"
|
||||
Margin="3"
|
||||
Background="{DynamicResource MaterialDesignLightBackground}"
|
||||
Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
|
||||
@@ -229,7 +231,7 @@
|
||||
</StackPanel>
|
||||
</materialDesign:Card>
|
||||
|
||||
<materialDesign:Card
|
||||
<!--<materialDesign:Card
|
||||
Grid.Column="3"
|
||||
Grid.ColumnSpan="3"
|
||||
Margin="3"
|
||||
@@ -252,11 +254,11 @@
|
||||
|
||||
|
||||
</StackPanel>
|
||||
</materialDesign:Card>
|
||||
</materialDesign:Card>-->
|
||||
|
||||
<materialDesign:Card
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.ColumnSpan="6"
|
||||
Margin="3"
|
||||
Background="{DynamicResource MaterialDesignLightBackground}"
|
||||
Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
|
||||
@@ -268,16 +270,17 @@
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="26"
|
||||
Text="" />
|
||||
<TextBlock Style="{StaticResource TitelStyle}" Text="总时间:" />
|
||||
<TextBlock Style="{StaticResource TitelStyle}" Text="总运行时间:" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="30"
|
||||
FontSize="26"
|
||||
FontWeight="Bold"
|
||||
Text="" />
|
||||
Foreground="LimeGreen"
|
||||
Text="{Binding MachineRtDataService.CurSysExdInfo.RunTimeMsg}" />
|
||||
</StackPanel>
|
||||
</materialDesign:Card>
|
||||
|
||||
<materialDesign:Card
|
||||
<!--<materialDesign:Card
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Grid.ColumnSpan="2"
|
||||
@@ -323,7 +326,7 @@
|
||||
FontWeight="Bold"
|
||||
Text="0" />
|
||||
</StackPanel>
|
||||
</materialDesign:Card>
|
||||
</materialDesign:Card>-->
|
||||
|
||||
<materialDesign:Card
|
||||
Grid.Row="2"
|
||||
@@ -942,13 +945,14 @@
|
||||
CellTitle="电流"
|
||||
CellUnit="{Binding ComCapBusCurTag.Unit}"
|
||||
CellValue="{Binding ComCapBusCurTag.EngPvValueStr}" />
|
||||
<!-- CellUnit="{Binding ComCapPwTag.Unit}" -->
|
||||
<Controls:ValueShow
|
||||
Canvas.Left="301"
|
||||
Canvas.Top="220"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
CellTitle="功率"
|
||||
CellUnit="{Binding ComCapPwTag.Unit}"
|
||||
CellUnit="Kw"
|
||||
CellValue="{Binding ComCapPwTag.EngPvValueStr}" />
|
||||
<Controls:ValueShow
|
||||
Canvas.Left="105"
|
||||
@@ -1054,15 +1058,23 @@
|
||||
Content="CCV2
冷凝器出水"
|
||||
FontSize="16"
|
||||
FontWeight="Bold" />
|
||||
<Label
|
||||
Canvas.Left="1247"
|
||||
Canvas.Top="4"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Content="工艺流程图"
|
||||
FontSize="30"
|
||||
FontWeight="Bold"
|
||||
Foreground="Gray" />
|
||||
<StackPanel
|
||||
Canvas.Left="1250"
|
||||
Canvas.Top="5"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="30"
|
||||
Foreground="Gray"
|
||||
Text="" />
|
||||
<Label
|
||||
Content="工艺流程图"
|
||||
FontSize="30"
|
||||
FontWeight="Bold"
|
||||
Foreground="Gray" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</Canvas>
|
||||
</Grid>
|
||||
|
||||
@@ -654,7 +654,7 @@
|
||||
|
||||
<DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="COND1温度
(℃)" />
|
||||
<TextBlock FontWeight="Bold" Text="冷凝器出口水温
(℃)" />
|
||||
</DataGridTemplateColumn.Header>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
@@ -663,6 +663,17 @@
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="吸气混合器温度
(℃)" />
|
||||
</DataGridTemplateColumn.Header>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding MeterOS2TempInfo}" TextWrapping="Wrap" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<!--<DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="润滑油压力
(MpaA)" />
|
||||
@@ -696,17 +707,6 @@
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>-->
|
||||
|
||||
<DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="LV电压
(V)" />
|
||||
</DataGridTemplateColumn.Header>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding MeterLVVolInfo}" TextWrapping="Wrap" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="HV电压
(V)" />
|
||||
@@ -720,11 +720,11 @@
|
||||
|
||||
<DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="压缩机环境湿度
(%)" />
|
||||
<TextBlock FontWeight="Bold" Text="LV电压
(V)" />
|
||||
</DataGridTemplateColumn.Header>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding MeterEnvRHInfo}" TextWrapping="Wrap" />
|
||||
<TextBlock Text="{Binding MeterLVVolInfo}" TextWrapping="Wrap" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
@@ -740,6 +740,18 @@
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
|
||||
<DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="压缩机环境湿度
(%)" />
|
||||
</DataGridTemplateColumn.Header>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding MeterEnvRHInfo}" TextWrapping="Wrap" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<!--<DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="EVAP出口温度(℃)
(℃)" />
|
||||
@@ -762,17 +774,6 @@
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>-->
|
||||
|
||||
<DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="OS2温度
(℃)" />
|
||||
</DataGridTemplateColumn.Header>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding MeterOS2TempInfo}" TextWrapping="Wrap" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<!--<DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock FontWeight="Bold" Text="PTC入口温度 
(℃)" />
|
||||
|
||||
64
CapMachine.Wpf/Views/SplashScreenView.xaml
Normal file
64
CapMachine.Wpf/Views/SplashScreenView.xaml
Normal file
@@ -0,0 +1,64 @@
|
||||
<sync:ChromelessWindow
|
||||
x:Class="CapMachine.Wpf.Views.SplashScreenView"
|
||||
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:CapMachine.Wpf.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:sync="http://schemas.syncfusion.com/wpf"
|
||||
x:Name="ChromelessWindow"
|
||||
Width="940"
|
||||
Height="550"
|
||||
ResizeMode="NoResize"
|
||||
ShowMaximizeButton="False"
|
||||
TitleBarHeight="0"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<prism:Dialog.WindowStyle>
|
||||
<Style TargetType="Window">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="SizeToContent" Value="WidthAndHeight" />
|
||||
</Style>
|
||||
</prism:Dialog.WindowStyle>
|
||||
<sync:ChromelessWindow.Triggers>
|
||||
<EventTrigger RoutedEvent="Loaded">
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ThicknessAnimation
|
||||
Storyboard.TargetName="ChromelessWindow"
|
||||
Storyboard.TargetProperty="Margin"
|
||||
From="300,200"
|
||||
To="0"
|
||||
Duration="0:0:0.45" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
</sync:ChromelessWindow.Triggers>
|
||||
<Grid Margin="-10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image
|
||||
Grid.RowSpan="2"
|
||||
Source="/Assets/Images/Logo.png"
|
||||
Stretch="UniformToFill" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Margin="50"
|
||||
VerticalAlignment="Bottom">
|
||||
<TextBlock
|
||||
FontSize="18"
|
||||
FontWeight="Bold"
|
||||
Foreground="White"
|
||||
Text="{Binding DisplayText}" />
|
||||
<sync:SfLinearProgressBar
|
||||
Margin="0,20"
|
||||
IsIndeterminate="True"
|
||||
ProgressColor="white" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</sync:ChromelessWindow>
|
||||
32
CapMachine.Wpf/Views/SplashScreenView.xaml.cs
Normal file
32
CapMachine.Wpf/Views/SplashScreenView.xaml.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Prism.Services.Dialogs;
|
||||
using Syncfusion.Windows.Shared;
|
||||
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 CapMachine.Wpf.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// SplashScreenView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SplashScreenView : ChromelessWindow, IDialogWindow
|
||||
{
|
||||
public SplashScreenView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public IDialogResult Result { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user